Android Studio 3.0 Preview - Studio does not have write access
Asked Answered
A

19

62

I'm using Android Studio 3.0 Canary 1. I'm trying to update it to Android Studio 3.0 Canary 2 but it shows the following error:

Studio does not have write access to /private/var/folders/mk/h5qpw_r11_7ggh9q52n9hhlr0000gn/T/AppTranslocation/1321881E-C41D-4AF7-B207-F31894226D50/d/Android Studio 3.0 Preview.app/Contents. Please run it by a privileged user to update.

I even tried running Android studio with sudo from the command line:

sudo /Applications/Android\ Studio 3.0 Preview.app/Contents/MacOS/studio

But it didn't work. Any help will be much appreciated.

Aboral answered 27/5, 2017 at 6:22 Comment(4)
did u try opening it by click clicking on the android studio and open as administrator ?Fleischer
@ReyanshMishra I work on Mac, it doesn't have 'open as administrator' option.Aboral
try to give it the way u would in mac.Fleischer
first i made finder to show all hidden files. and then moving to the path shown in android studio via Finder, i put the androidstudio.app file to application. Opened Android studio from applications and the problem solved.Rotten
A
5

I was using the wrong command, it should be as given below:

sudo /Applications/Android\ Studio\ 3.0\ Preview.app/Contents/MacOS/studio
Aboral answered 27/5, 2017 at 8:1 Comment(1)
I am getting this error after executing above command: /Applications/Android Studio 3.0 Preview.app/Contents/MacOS/studio: command not foundLend
M
85

You are a victim of the new macOS Sierra security feature called Path Randomization. Read more in the relevant thread. The simple way to get rid of this read-only random path is to move the app binary to a different folder (e.g. /Applications) with Finder (not command line, not PathFinder, just built-in Finder). It will move the app out of the quarantine. Other ways are described in the previous link.

Mutualism answered 14/8, 2017 at 10:40 Comment(3)
I've moved Android Studio to Applications (be careful, as this will disrupt all of your AVD devices with custom configurations, skins, etc) but I'm still getting this error. Is there some other configuration I need to edit?Massotherapy
Just happened while running Monterey; Studio was already in Applications folder; fixed by simply opening another Finder window to the Downloads folder; while holding down Cmd drag Studio to the downloads folder and then I simply dragged it back to the Applications folder (again holding down Cmd). Update worked fine after that. I also removed Studio from the dock and re-added it to the dock for safe measure. Hope that helps!Newhouse
This was happening in my case also. Just moving to Application folder alone and trying to update didn't went well. Then I Exited from android studio and reopened it from application section, and Voila! It worked! Thanks @Mateusz for the ideaNordrheinwestfalen
C
42

The easiest solution ever: I moved the Android Studio 3.5 Canary file from the Downloads folder to Applications folder.

note: make sure Android Studio not running.

Clayclaybank answered 13/6, 2019 at 19:15 Comment(3)
This should be the accepted answer. Easiest way to fix the issue.Gideon
This really worked in macbbok m1. kudos...Papacy
M1 can confirm this worked and it's nice to see likeminded people putting things in the Download folder and just rolling with it hahaDysfunction
F
40

It seems you can also run into this issue if you have Android Studio installed via JetBrains Toolbox. The solution then is to just quit Android Studio, and install the update via the ToolBox.

Fourdrinier answered 7/2, 2019 at 16:18 Comment(2)
Exactly! Thanks, it helps me.Forebear
There is a slight delay between the time Android Studio and Toolbox get the update. I had to wait a couple of minutes before the update was available in Toolbox. Just wait a bit so that it is available for update.Byproduct
K
38

Another workaround:

Reference to the IntelliJ IDEA / MacOS Sierra issue: Upgrading IntelliJ IDEA after Sierra Upgrade: does not have write access to /private/var

This worked for me, replaced IDEA path with my Android Studio Directory

sudo xattr -d com.apple.quarantine /Applications/Android\ Studio.app
sudo chmod -R 777 /Applications/Android\ Studio.app
Kamilah answered 27/3, 2018 at 5:35 Comment(7)
I have just used sudo chmod command mentioned in this answer and it worked.Skinhead
yes only sudo chmod -R 777 /Applications/Android\ Studio.app would be enough to get write permissions and update the android studio, this worked for me as per the above commentEducable
The chmod was not necessary for me, but the xattr did the trick. Thanks!Essayistic
This is the only solution that worked for me.Hyacinthhyacintha
This was the only solution that worked for me.Cocci
I got the problem after migrating to a new macbook, this answer helped, thanksSpiritualist
Giving all-you-can-do permissions to apps is dangerous, and so, wrong. Follow @Mateusz Ślażyński answer for the solution and its relative comments.Cacka
P
31
  1. Go to applications->Android Studio
  2. Right click and select "Show Package Content"
  3. Right click on Contents folder and select "Get info"
  4. Look for "Sharing & Permission" option.
  5. Give read & write permission to your user.
  6. From gear icon select "Allow for enclosed item"
Pifer answered 11/6, 2019 at 11:47 Comment(4)
Make sure to do the "Allow for enclosed items" otherwise, the message is indeed gone, but upon restart of Android Studio installing the patch fails!Suint
Doesn't work on MacOS 12.5 (Monterey)Elston
It worked for me on MacOS 12.6 (Monterey)Wallow
@Suint I cannot find the "Allow for enclosed items" option. Where is it located?Boneblack
R
8

Simply move to Application folder. From----> /private/var/folders/............./d/ TO ----->. /Application or write access folder....

Razz answered 27/5, 2018 at 10:3 Comment(0)
A
5

I was using the wrong command, it should be as given below:

sudo /Applications/Android\ Studio\ 3.0\ Preview.app/Contents/MacOS/studio
Aboral answered 27/5, 2017 at 8:1 Comment(1)
I am getting this error after executing above command: /Applications/Android Studio 3.0 Preview.app/Contents/MacOS/studio: command not foundLend
F
5

The same error showed in my Android studio as well, when I tried to update. So I copied my existing Android Studio.app file from a private folder to the Application folder. This fixed my issue.

Fetial answered 3/8, 2018 at 14:57 Comment(0)
L
5

In my case on Mac, Android Studio wasn't opened from the Applications folder for some reason. Make sure you open the one that's there and not a copy that's saved elsewhere, otherwise it won't have the privileges.

Lipfert answered 27/5, 2019 at 10:37 Comment(1)
I think this is my problem. How to know where is it opening from?Boneblack
L
5

Possible solution in case Android Studio application is in the download folder:

Ran into a similar issue on Big Sur:

  • I moved it to the application folder
  • reopened Android Studio
  • retried update

Solved in my case.

Lifeline answered 2/10, 2021 at 6:14 Comment(1)
Awesome answer. This is the perfect solution. Its working for me as well.Leek
F
4

In Mac goes to android studio location:

  1. Right click on android icon and select reveal in Finder

  2. Than In Finder, select Android Studio File and right click and select -> Show package contents

  3. Then, Select contents folder and right click and select get info then Go to sharing and permissions and select read and write than exit
  4. Open Android Studio and check for updates, its done.
Frenzy answered 22/5, 2018 at 6:32 Comment(0)
F
3

You should not run something as bloated as Android Studio under "Sudo" as that gives full root access to every bit of code in it, and leaves any files it creates as owned by root! Talk about malware heaven...

The OP on this post mentioned that the problem is in /var/folders/... not in /Applications. For some reason, when you run Android Studio 3.x, it somehow gets itself mounted on /var/folders, as you can see by opening a terminal window and giving the command "mount":

/Applications/Android Studio 3.0 Preview.app on /private/var/folders/58/d2drp3pn7q10p6rqhck1t89c0000gn/T/AppTranslocation/80A800C1-65DB-4933-9B88-5CF90BFC8B0D (nullfs, local, nodev, nosuid, read-only, nobrowse, mounted by ida)

This does not happen when you run Studio 2.3 or any other normal application, so I'm guessing it's some "new improved" feature of 3.x that is causing this trouble.

Problem remains unsolved.

Fitzsimmons answered 12/7, 2017 at 18:51 Comment(0)
O
3

Using the terminal and going to Android Studio binary and executing from terminal, such as

cd /Applications/Android\ Studio.app/Contents/MacOS/
./studio

Solved the problem for me.

It appears that launching a binary directly from terminal does not launch App Translocation protection. More information here

Ovule answered 11/2, 2019 at 12:53 Comment(1)
This solved the problem for me as well; thanks a bunch!Nadabas
R
3

Your app can be out of applications folder. Did you check it. First check then if it is not in app folder move to app folder and try again.

If it doesn't work you must try terminal commands that the other answers.

Randall answered 9/10, 2019 at 8:49 Comment(0)
G
2

if your using Ubuntu android 3.0 and getting error while updating to latest version and if you installed android studio using android installation guide example official video then you have to run sudo chown -R $USER:$USER /usr/local/android-studio/ this commend in your terminal

Gelman answered 19/4, 2018 at 18:36 Comment(0)
M
1

I had similar issue on my mac after migrating OS. This worked for me: Go to /Applications/Android Studio ... /Contents right click contents directory -> get info ->sharing and permission ,click lock icon to unclock settings then give your account read & write permission. then while your account type (admin)is selected click settings icon below and chose apply to enclosed items . done

Mccutcheon answered 28/3, 2018 at 19:5 Comment(0)
D
0

My problem: I was opening my Android Studio directly from the "virtual device", then when I needed to update it always the prompt with the message "android studio does not have write access ..." was shown.

After right click on Android Studio icon in dock > Options > Show in Finder always opened the virtual device with the option to swipe it to the Apps folder. I did it, replaced the version in the Apps folder and ran again the same steps: right click on Android Studio icon in dock > Options > Show in Finder .

Now Finder showed AS in Apps folder. After this, after a new version of AS, it's possible without showing "android studio does not have write access ..." error.

Durer answered 18/4, 2018 at 19:23 Comment(0)
A
0

In my case the Android Studio is installed with brew. When using upgrade from UI it shows me the error described above. To upgrade the version I use:

brew upgrade android-studio

Then it works without issues.

Aberration answered 1/9, 2020 at 12:55 Comment(0)
C
-1

This happened to me when I was running an Android Studio Preview build from within the downloads folder. I forgot to move it to the Applications folder — upon doing so, everything worked as expected!

Crummy answered 10/6, 2019 at 17:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.