Jonathan Soifer
Jonathan Soifer

Reputation: 2827

How to solve Permission Denied when running Sublime Text 3 from the terminal?

The system is a Mac OS X El Capitan running Sublime Text 3.

I was perfectly able to run ST3 from the terminal, using the symbolic link by typing "subl". I have no idea what could have possibly changed.

Now everytime I try to start subl from the terminal in any given directory (by running "subl .") I get a "Permission Denied" window every 5 seconds.

[Sublime opens the specified directory, whichever it is, and then everytime I switch back to ST3, the window pops up "Permission Denied"]

The only message in ST's console is: "error: Permission denied".

When opening Sublime Text from the GUI (not CLI), this doesn't happen at all.

Upvotes: 11

Views: 25922

Answers (8)

Nagibaba
Nagibaba

Reputation: 5338

Run sudo /Applications/Sublime\ Text.app/Contents/MacOS/Sublime\ Text from console. It will open a new Sublime window as root user

Upvotes: 0

blueberry
blueberry

Reputation: 354

Simple solution: While you save the file in sublime Text. It asks for the location. Check if the default location to save is "/" directory. If yes, change the directory location as you don't have permission to create a new file in / folder Note: If Sublime is not asking for the directory, use "Save as" option

Upvotes: 1

Randy
Randy

Reputation: 61

On my OS X El Capitan, when starting Sublime Text 3 from the app icon, it had issues with the environment PATH. As a result, it found Apple's git at /usr/bin/git and there was no "Permission Denied" every 10 seconds. However, when starting from the command line, from what I've read about Sublime and Paths, I assumed it would use the existing PATH from the bash session and find MY git install located at /usr/local/bin/git. For some reason, it wasn't doing that and must've been using another git or couldn't find any at all.

My Fix:
I edited my Git.sublime-settings (Sublime Text > Preferences > Package Settings > Git > Settings - User) and the Permission Denied popups stopped. I restarted a few times from both the app icon and CLI and it's gone. The Tools > Git commands all work fine and there's no more issue.

Git.sublime-settings file:
{
  "git_command": "/usr/local/bin/git"
}

Use the path to your git install.

Upvotes: 0

Alisher Musurmonv
Alisher Musurmonv

Reputation: 845

If you have installed Git for Sublime 3 it causes an error and popup "Permission Denied" If you deleted any project file or folder that has been hosted in github.

Solution: Delete the Git package and reinstall it. You can do

cmd+shift+p and select "Package Control: Disable Package" and select Git

Hope it helps.

Upvotes: 7

jamesnotjim
jamesnotjim

Reputation: 575

From the GUI, doing File > Save As... and navigating to the folder a second time cleared it for me. I had been reorganizing folders and files in the Finder, opened one, and attempted to do a Save As... when I got the error.

I checked file and folder permissions via File > Get Info, but everything was fine there. Not sure why Sublime Text got confused.

Upvotes: 1

Gavy
Gavy

Reputation: 143

  1. Right click on your main folder.
  2. Get Info
  3. Sharing & Permissions. (Unlock if necessary)
  4. Add a new user and add yourself into the group. Press OK.
  5. Change your Privilege from 'Read only' to 'Read & Write'.
  6. Wait for the changes to be completed and try to save. You should be able to save now.

Upvotes: 1

Jonathan Soifer
Jonathan Soifer

Reputation: 2827

The only way I could find was disabling all the plugins altogether.

This stopped the error message. Now I'm enabling them back, one by one, so far so good.

Upvotes: 1

Arthur
Arthur

Reputation: 462

Disable csrutil by rebooting in recovery mode (cmd + r on startup) then Utilities > Terminal

csrutil disable

then reboot your mac as you normally would. csrutil should do it but I have heard others supposedly needed to disable gatekeeper as well...

Disable gatekeeper in terminal with:

sudo spctl --master-disable

Upvotes: 2

Related Questions