Tag Archives: developer

Create a new project and select Other from under the OS X category when the dialog appears, and then choose External Build System:

Tap to enlarge

In the next page, give your project a name “product name” and then in the “build tool”, choose the path of your Python interpreter. If you don’t know where your Python interpreter is, open Terminal and type in which python to get the path to the interpreter, like so:

Tap to enlarge

Then save your project on disk

From the Product menu, choose Scheme and then Edit Scheme or just Option-click the little Play button on top left of Xcode. Now you should see the Edit Scheme screen which looks like this:

Tap to enlarge

Now tap on the Info tab on top of the dialog and then press on the Executable combo-box (which currently says “None”) and then from the list, choose “other…”

Tap to enlarge

An open-dialog will appear waiting for you to select your build tool, again! This is a bug in Xcode. So press the Cmd+Shift+G button in the open-dialog and when the “Go to the folder” dialog appears, enter the path of your Python interpreter again like so:

Tap to enlarge

Once you are done, press the Go button and then press the Choose button

Back in the Edit Scheme dialog, uncheck the “Debug executable option as you don’t want Xcode to attach the LLDB debugger to Python. That’s not useful. This step is very important.

Tap to enlarge

Now tap on the Arguments tab and then under the “Arguments Passed on Launch”, press the + (plus) button and then type in “test.py” without the quotation marks, like so:

Tap to enlarge

Now tap on the Options tab and then under the “Working directory” section, tap the “Use custom working directory” and then tap on the little Folder button. Once the open-dialog appears, choose the root folder of your Xcode project:

Tap to enlarge

Now press the Close button to close the Edit Scheme dialog

Press the Cmd+N combination on keyboard or just select from the menus, File->New->File…

In the New file dialog, from the left hand side, choose OS X and then Other and then choose Empty and then press the Next button:

Tap to enlarge

Name your file “test.py” (without the quotation marks) and then ensure that you are saving it under your project’s main folder, the same folder that you set your “Working directory” to a few steps ago. Once you are done, press the Create button.

Tap to enlarge

Write a simple Python script in your “test.py” file like so:

Tap to enlarge

Now run your application and have a look at the console in Xcode to see your Python script successfully executed:

Tap to enlarge

That was it really. Good luck everyone. If you have any questions, just let me know.

You can see right away that c++ is a symlink to clang++ and clang++ is a symlink to clang. What a mess!

Now let’s find “cpp”:

ls -la cpp
ls: cpp: No such file or directory

Oopsy daisy, it’s not there. That’s one of the issue a lot of developers will be facing. So let’s remedy this by first creating cpp as an alias. We want this alias to be permanent between Terminal sessions so we put it in our bash_profile and we also have to make sure the toolchain bin url highlighted above is in our path:

vim ~/.bash_profile

And then change the content of your bash profile so that your path includes:

Yesterday I wanted to compile a .c code for ARM architecture using the iOS SDK on my Lion machine. I wanted to create object files and executable files that I can install on my jailbroken iPhone 4. I have explained the process here for you. I hope it will be of help.

We are going to be using the LLVM-GCC compiler. In OS X Lion, this compiler sits here:

Also we need to pass the path to our iOS SDK, to the compiler so that it knows where to get the libraries and frameworks from. In OS X Lion with iOS SDK 5.1 installed, the path of the iOS SDK would be here:

Like this:

Xcode 4.3.x or newer comes with Git but the problem is when you install Xcode on your machine (OS X Lion or newer), Git’s path won’t be added to the user path which means if you run git from your command-line, your system will say:

-bash: git: command not found

Xcode’s installation of Git is at the following location on your machine:

/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/

With the git binary sitting here:

/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git

To add this binary to your path (which will allow you to run “git” from any directory on your system), go to terminal and type this command:

There is one caveat to this approach and that is the PATH will only be changed in your current running instance of terminal. As soon as you close terminal and open it again, you will have to enter the above command again to get access to the git app. So what is the proper solution? You will have to add the above “export” command to the .profile file in your home directory. The .profile file gets read every time you open terminal. So open a terminal instance and type the following command:

cd ~/

And then type this command:

ls -la | grep “.profile”

We are trying to find out if we already have a file named .profile in our home directory. If after running the above command you won’t see anything getting printed to the terminal, use the following command to create a new .profile file. If you already have a .profile file, skip this command:

touch .profile

Now open the .profile with this command:

open .profile

Now add the git path to the PATH variable in the .profile file so that your .profile content will look something like this (it really depends on what you already have in this file. I am assuming your .profile file didn’t exist until now and you just created it):

Share this post

Like this:

Only for developers though! It’s a developer preview version. Here is what Apple said today:

Apple today released a developer preview of Mac OS X Lion, which takes some of the best ideas from iPad and brings them back to the Mac for the eighth major release of the world’s most advanced operating system. Lion features Mission Control, an innovative new view of everything running on your Mac; Launchpad, a new home for all your Mac apps; full-screen apps that use the entire Mac display; and new Multi-Touch gestures. Lion also includes the Mac App Store, the best place to discover, install, and automatically update Mac apps. The Lion preview is available to Mac Developer Program members through the Mac App Store today, and the final version of Lion will ship to customers this summer.