[Android SDK] Installing Gradle in command-line shell (MacOS X)

Once we install Android Studio (or just gradle itself), it is very comfortable to have it added to our PATH, which makes us able to run commands like

gradle task1

from any Android project’s folder.

One way to do that is adding gradle’s path to our PATH variable. Under MacOS X, this is done with the following steps.

1.- In terminal:

export GRADLE_HOME=/Applications/Android\ Studio.app/Contents/gradle/gradle-2.2.1

*We assume we’re using the bundled Gradle that comes with Android Studio. You can place gradle anywhere else, like your /Users/user folder, and use this location. Example:

export GRADLE_HOME=/Users/jimmy/gradle-2.2.1

2.- Now, let’s have a look at our PATH variable. In terminal:

echo $PATH

It should look like:

/usr/bin:/bin:/usr/sbin: ... (more system folders separated by ":" )

To append gradle’s folder at the end of our path:


Now, execute “echo $PATH” again, and you should see gradle’s folder appended in the end, separated by a “:”.

If you were successful on step 2, you should now be able to execute:

gradle –version

And see an output like:

Gradle 2.2.1
Build time:   ...
Build number: none
Revision:     6fcb59c06f43a4e6b1bcb401f7686a8601a1fb4a
Groovy:       2.3.6
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.6.0_65 (Apple Inc. 20.65-b04-462)
OS:           Mac OS X 10.9 x86_64

Hope it helps!

Marmalade Mac SDK – Opening a project from existing code

Sometimes things are so obvious, that we find them difficult.

It took me 20 minutes to guess how to open a Marmalade project (.mkb file) in a Mac laptop.
When double-clicking the .mkb, it asked me about which program to use to open that file. (the “Select application, Cancel, Search in App Store”…). So i had to do the following:

1.- Open a terminal (Ctrl+Space, then write “Terminal”).

2.- To make sure that mkb.py python script is in the current pathname, write “mkb –help”. If you get a long list of available options, then the script is correctly placed. If not, see the end of this post

3.- Change to the project’s directory; Where the .mkb is. (in my case: “cd /Users/user/Desktop/MyProject”)

4.- write “mkb MyProject.mkb”. Some Marmalade resources may be downloaded, then Xcode is automatically launched to start working with the project. Additionally, a “build_xxx” directory should be created inside the “MyProject” directory. Inside, there is an .xcodeproj file that you can double-click to open the project with Xcode from now on.

As silly as that 🙂
Hope it helps

* If step 2 fails and you get “command not found”, you should add the Marmalade path to your current system PATH variable.In a terminal, write:

export PATH=/Developer/Marmalade/6.1/s3e/bin:$PATH

to check if all went fine:

echo $PATH

the PATH value should appear. it should have “/Developer/Marmalade/6.1/s3e/bin” in the beginning, and more pathnames separated by “:”.