212

Where should the Android SDK be installed on Mac OS X?

George Stocker
  • 57,289
  • 29
  • 176
  • 237
Carl Manaster
  • 39,912
  • 17
  • 102
  • 155
  • 10
    I think that using `brew` to install it answers your question and also solves other possible issues like upgrading it. Check my answer below. – sorin Oct 08 '11 at 13:43
  • 4
    the **obvious, default, usual** location, **where it is installed by default** is simply ~/Library/Android/sdk/. Where else would you possibly want it than there - and that's the default installation location. – Fattie Jun 25 '15 at 16:54
  • 2
    On my OS X system with Android Studio, it was installed in `~/.android-sdk/` by default. – Elliot Jul 22 '15 at 17:24

13 Answers13

444

The easiest (and standard) way to install Android SDK under OS X is to use brew.

brew install android-sdk

If you do not have homebrew, here's how to get it.

This will install Android SDK into /usr/local/Cellar/android-sdk/ and, at this moment, this is the best location to install it.

cubuspl42
  • 7,833
  • 4
  • 41
  • 65
sorin
  • 161,544
  • 178
  • 535
  • 806
  • 14
    @kalev it might be worth reporting that to Eclipse or IntelliJ, the IDEs should not be referencing the resolved Cellar directory which includes the version number. They should only reference `/usr/local/opt/android-sdk`. – James Wald Apr 02 '14 at 21:58
  • 7
    Homebrew rocks! You can also run `android update sdk --no-ui` after installing with Homebrew to get the latest SDK release. The --no-ui option if you only use the CLI of course (i.e. with Cordova) - Win! – Antony Sastre Jul 17 '14 at 12:10
  • This works great. I am having problems with the permissions on other users, though. There, Android Studio refuses to start. – Hauke May 19 '15 at 18:17
  • Just one folder deeper :) for me its /usr/local/Cellar/android-sdk/24.4.1/ – Lukas Liesis Nov 09 '15 at 21:10
  • @AntonySastre that would be e.g., not i.e.. You can use the CLI with things other than Cordova. – Aristides Dec 12 '15 at 21:08
  • this should be the best answer, not only for installation, its home-brew also help to update, uninstallation – damithH Sep 01 '16 at 08:42
  • This command was recommened to me. brew cask install android-sdk – user2677679 Aug 29 '20 at 12:08
  • For me, it got installed at: `/usr/local/Caskroom/android-sdk/` – learner Aug 04 '21 at 06:57
  • Mine got installed at `/usr/local/share/android-sdk` – Chuks Jr. Nov 18 '21 at 10:55
94

In homebrew the android-sdk has migrated from homebrew/core to homebrew/cask.

brew tap homebrew/cask

and install android-sdk using

brew install android-sdk --cask 

You will have to add the ANDROID_HOME to profile (.zshrc or .bashrc)

export ANDROID_HOME=/usr/local/share/android-sdk

If you prefer otherwise, copy the package to

~/opt/local/android-sdk-mac
ReaperSoon
  • 765
  • 7
  • 23
gmuraleekrishna
  • 3,375
  • 1
  • 27
  • 45
  • Unfortuantely this currently fails, because the licenses ar not automatically accepted. The installation just fails. `The following packages can not be installed since their licenses or those of the packages they depend on were not accepted: extras;intel;Hardware_Accelerated_Execution_Manager emulator tools ... ==> Exit status of failed command: #` – Pete Dec 19 '17 at 09:50
  • 2
    It seems I could temporarily fix the install script: `brew cask edit android-sdk` I edited the preflight command. I modified `input : 'y'` to `input : 'y y y y y y y '` A newline between every `y` – Pete Dec 19 '17 at 09:59
  • 1
    @Pete This problem no longer exists in homebrew cask –  Mar 19 '18 at 23:03
  • 1
    this answer messed up my package. **Do not Use This** – Yuseferi Feb 25 '19 at 13:25
  • @gmuraleekrishna `Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-cask-cask /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask-cask --depth=1` exited with 128.` – DolDurma Jan 29 '20 at 08:44
  • @DolDurma the problem seems to be with your homebrew. The git url is not supposed to have the second '-cask' at the end. Try again after `brew tap homebrew/cask` – gmuraleekrishna Jan 31 '20 at 11:01
41

When I installed Android Studio 1.0 it ended up in

/Library/Android/sdk/

sudo bangbang
  • 27,127
  • 11
  • 75
  • 77
rara
  • 470
  • 4
  • 8
  • 21
    In my case it was in ~/Library/Android/sdk/ – Daniel Gray May 12 '15 at 16:46
  • If anyone has trouble finding the `/Library` folder on Mac, the best way to do it is to open a Terminal, then type `open Library` in your `/~` folder, then drag & drop the SDK directory onto the file browser. – EpicPandaForce Aug 13 '19 at 13:12
39

My personal preference is to put it in ~/opt/local/android-sdk-mac or /Developer/android-sdk-mac the latter being where Xcode and all the Apple Dev tools are held.

John Wang
  • 6,136
  • 2
  • 28
  • 23
  • 2
    Accepted answer; although the others are true - the kit can be installed anywhere - this is in the spirit of my question and gives me something concrete to work with. Thanks. – Carl Manaster Apr 21 '10 at 17:22
  • 38
    For future readers, do not store under /Developer/android-sdk-mac or anywhere under /Developer if you're on iOS 10.6, because when you upgrade to 10.7, Apple throws your /Developer directory in the .Trash – James Jul 27 '12 at 16:10
  • 9
    @James you mean OSX, not iOS ;) – Nimrod Dayan Feb 15 '14 at 16:12
  • 5
    installing with homebrew (see sorin's answer) is much nicer than dropping it in some random place in the filesystem. – gorjusborg Apr 13 '14 at 21:33
32

By default the android sdk installer path is ~/Library/Android/sdk/

Weston Ganger
  • 6,324
  • 4
  • 41
  • 39
20

You can install android-sdk in different ways

  1. homebrew
    Install brew using command from brew.sh

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"  
    

    Install android-sdk using

    brew install android-sdk
    

    Now android-sdk will be installed in /usr/local/opt/android-sdk

    export ANDROID_HOME=/usr/local/opt/android-sdk
    
  2. If you installed android studio following the website,
    android-sdk will be installed in ~/Library/Android/sdk

    export ANDROID_HOME=~/Library/Android/sdk
    

I think these defaults make sense and its better to stick to it

Graham
  • 7,431
  • 18
  • 59
  • 84
sudo bangbang
  • 27,127
  • 11
  • 75
  • 77
  • Error: No available formula with the name "android-sdk" It was migrated from `homebrew/core` to `homebrew/cask`. `brew cask install android-sdk` – Vladimir Vukanac Aug 27 '18 at 07:27
7

From http://developer.android.com/sdk/index.html, it seems that you can install the SDK anywhere, so long as you

  1. "execute the android tool in the <sdk>/tools/ folder"
  2. Add the <sdk>/tools directory to your system path

More info can be found here: http://developer.android.com/sdk/installing.html

Justin Johnson
  • 30,978
  • 7
  • 65
  • 89
  • Thanks, I've been looking at that page, but I'm really looking for some kind of consensus good place to put it. – Carl Manaster Apr 20 '10 at 18:01
  • 2
    The best place to put it is where you will remember where it is located - and no, I'm not being smarmy (or specious), it's just that this is a personal choice and typically not a professional one. – KevinDTimm Apr 20 '10 at 18:14
  • 2
    Thanks, Kevin; I appreciate your logic. It's just that I don't have a standard place where I put these things, and I'm interested to know what an unsurprising place would be for other developers. There are a lot of standard places for things in unix - and the standards seem sometimes to be required by some software, that is, more than just convention. I realize Macs are free-er, but would still like to conform to some kind of standard or convention. – Carl Manaster Apr 20 '10 at 18:52
6

I just have mine in MyUser/Documents/Development. I'm the only one that used my Mac, so I didn't need to worry about making it accessible system-wide.

CaseyB
  • 24,780
  • 14
  • 77
  • 112
4

I put mine in /Developer/SDKs I had to authenticate to do that…but since there's no consensus I thought that it sounded like a place I'd remember.

airgray
  • 321
  • 1
  • 3
  • 7
4

I ended up placing my at ~/sdks/android-sdk-mac_x86. I like to keep all of my SDKs in one place and for me an sdk folder under my home directory makes the most sense.

Carl Manaster
  • 39,912
  • 17
  • 102
  • 155
Tanner Watson
  • 260
  • 3
  • 9
3
brew install android-sdk --cask 
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
  • While this code may provide a solution to the question, it's better to add context as to why/how it works. This can help future users learn, and apply that knowledge to their own code. You are also likely to have positive feedback from users in the form of upvotes, when the code is explained. – Amit Verma Jan 27 '21 at 09:38
2

I have been toying with this as well. I initially had it in my documents folder, but decided that didn't make 'philosophical' sense. I decided to create an Android directory in my home folder and place Eclipse and the Android SKK in there.

finiteloop
  • 4,444
  • 8
  • 41
  • 64
0

A simple way is changing to required sdk in some android project the number of

compileSdkVersion

in build.gradle file and you can install with the manager

Álvaro Agüero
  • 4,494
  • 1
  • 42
  • 39