Mar 9, 2011

Xcode 4 is out (Updated)

Apple has just released its new IDE - Xcode 4.
The main news here is that it is not not entirely for free as it was with Xcode 3.

Members of iOS and Mac Developer programs will get it for free, others can purchase Xcode 4 in App Store for 3.99 Euro ($ 4.99).

Well, I've been using Xcode 4 since the first developer preview and I can only say that it definitely costs more than 4 Euro ;)

Just in case you want to uninstall a previous version of Xcode and don't know how to do so:
sudo /Developer/Library/uninstall-devtools --mode=all

or in case of Xcode 4 Developer Preview:
sudo /Xcode4/Library/uninstall-devtools --mode=all


Anonymous said...


could you set the code beautifier astyle script on xcode 4?
(Like this:

Thank you
Gergely Nagy

Anar Manafov said...


unfortunately the new Xcode doesn't have a user's script menu as it was in Xcode 3.
But I have a workaround and will post it very soon ;) be patient and come back for updates.

Best of luck,

Anonymous said...

Until you find a solution to run a macro, or some external bash file, here is a simple solution:

(But you need have astyle, and sudo to copy the text file into /bin)

Make a text file, example astyle-bat

Insert these lines:
astyle --brackets=break --indent=force-tab --min-conditional-indent=0 --pad-oper --unpad-paren --add-brackets --align-pointer=type --recursive "*.m"
astyle --brackets=break --indent=force-tab --min-conditional-indent=0 --pad-oper --unpad-paren --add-brackets --align-pointer=type --recursive "*.mm"
astyle --brackets=break --indent=force-tab --min-conditional-indent=0 --pad-oper --unpad-paren --add-brackets --align-pointer=type --recursive "*.cpp"
astyle --brackets=break --indent=force-tab --min-conditional-indent=0 --pad-oper --unpad-paren --add-brackets --align-pointer=type --recursive "*.h"

Or some other astyle configuration what you want.

Copy with sudo into /bin
There is also the astyle too.
Change mode to executable.

Then if you want some directory to "astyling", open terminal, cd + drag&drop the dir name from finder window, and do:

I know it's a very ugly solution, but better like nothing.

I wait your solution, to do the same thing direct from xcode 4.

Maybe in prebuild step doing the call of astyle-bat?

Gergely Nagy

Anar Manafov said...

Sorry for the delay. Couldn't answer earlier :( there were too much work these days.

Concerning the "user script" menu missing. I think, Apple removed it, because they want us to use automator in general.

Your idea is OK. But what I really want is to control what I do, for example, what if I want to do something with a part of the text only (with the selected text)...

Also I want to to everything from within Xcode.

So, the basic idea is to have an automator workflow implemented as a bash (or python or perl) script, which takes the input from STDIN, does something with this input (astyle it, for example) and prints it out to stdout.
Set this workflow to a Service menu and that's it! When you select something you can call this "service" on it...
I am going to find some time on this week and going to write a topic, which will describe this idea.
This is at least a solution, which will work with Xcode or other editors.