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

倖福魔咒の 提交于 2020-01-12 17:36:37

问题


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.


回答1:


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.




回答2:


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




回答3:


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.




回答4:


  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.



回答5:


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.




回答6:


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




回答7:


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.



来源:https://stackoverflow.com/questions/33892381/how-to-solve-permission-denied-when-running-sublime-text-3-from-the-terminal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!