Terminal
/Library: 以 root 使用者身份登錄時不允許操作
我試圖在 El Capitan 上安裝 Jekyll,但是我確實收到了權限錯誤,如下所示。我以 root 使用者身份登錄。
Linards:~ Berzins$ sudo gem install jekyll Password: Ignoring psych-2.0.15 because its extensions are not built. Try: gem pristine psych --version 2.0.15 Ignoring json-1.8.3 because its extensions are not built. Try: gem pristine json --version 1.8.3 Fetching: jekyll-3.1.6.gem (100%) ERROR: While exexcuting gem ... (Errno::EPERM) Operation not permitted - /usr/bin/jekyll Linards:~ Berzins$ gem pristine psych --version 2.0.15 ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory. Linards:~ Berzins$ ls -l total 8 drwxr-xr-x 94 Berzins staff 3196 27 Mar 19:08 Applications drwx------+ 34 Berzins staff 1156 26 Jul 22:41 Desktop drwx------+ 16 Berzins staff 544 7 Jul 21:58 Documents drwx------+ 12 Berzins staff 408 23 Jul 20:58 Downloads drwx------@ 36 Berzins staff 1224 26 Jan 2015 Google Drive drwx------@ 60 Berzins staff 2040 7 Jul 21:58 Library -rw-r--r--@ 1 Berzins staff 724 8 Nov 2014 Linards Berzins.downsizelicense drwx------+ 3 Berzins staff 102 25 Aug 2014 Movies drwx------+ 7 Berzins staff 238 13 Feb 22:30 Music drwx------+ 20 Berzins staff 680 16 Jul 21:03 Pictures drwxr-xr-x+ 6 Berzins staff 204 23 Sep 2015 Public drwxr-xr-x 5 Berzins staff 170 9 Apr 20:53 WebstormProjects drwxr-xr-x 2 Berzins staff 68 18 Nov 2015 node_modules drwxr-xr-x 4 Berzins staff 136 19 May 21:55 sites drwxr-xr-x 25 Berzins staff 850 30 Sep 2015 veltaberzina.com drwxr-xr-x 6 Berzins staff 204 18 Nov 2015 version_control Linards:~ Berzins$ chmod 755 Library Linards:~ Berzins$ sudo chmod 777 /Library Password: chmod: Unable to change file mode on /Library: Operation not permitted
任何建議表示讚賞。
更新:在建議的命令之後 -
sudo chflags -R nouchg /Library
並ls -le /
得到輸出:Linards:~ Berzins$ ls -le / total 61 drwxrwxr-x+ 108 root admin 3672 26 Jul 22:53 Applications 0: group:everyone deny delete drwxr-xr-x 62 root wheel 2108 1 May 18:43 Library drwxr-xr-x@ 2 root wheel 68 1 May 18:34 Network drwxr-xr-x@ 4 root wheel 136 1 May 18:29 System 0: group:everyone deny delete lrwxr-xr-x 1 root wheel 49 25 Aug 2014 User Information -> /Library/Documentation/User Information.localized drwxr-xr-x 6 root admin 204 20 Jun 09:20 Users drwxrwxrwt@ 5 root admin 170 26 Jul 23:50 Volumes 0: group:everyone deny add_file,add_subdirectory,directory_inherit,only_inherit drwxr-xr-x@ 39 root wheel 1326 12 Mar 08:08 bin drwxrwxr-t@ 2 root admin 68 1 May 18:34 cores dr-xr-xr-x 3 root wheel 4316 29 May 11:59 dev lrwxr-xr-x@ 1 root wheel 11 1 May 18:32 etc -> private/etc dr-xr-xr-x 2 root wheel 1 23 Jul 21:03 home -rw-r--r--@ 1 root wheel 313 2 Aug 2015 installer.failurerequests dr-xr-xr-x 2 root wheel 1 23 Jul 21:03 net drwxr-xr-x@ 6 root wheel 204 1 May 18:34 private drwxr-xr-x@ 59 root wheel 2006 1 May 18:32 sbin -rw-rw-rw- 1 Berzins wheel 586 25 Jul 21:46 sockets.log lrwxr-xr-x@ 1 root wheel 11 1 May 18:32 tmp -> private/tmp drwxr-xr-x@ 12 root wheel 308 1 May 18:43 usr lrwxr-xr-x@ 1 root wheel 11 1 May 18:32 var -> private/var
最新版本的 Mac OS X 具有所謂的系統完整性保護,又名“SIP”,又名“無根”。它基本上使文件系統的某些部分對所有人都是只讀的,包括 root。你可能已經碰到了。
目的是防止錯誤和惡意軟體修改您的基本作業系統。有關
/System/Library/Sandbox/rootless.conf
受 SIP 保護的目錄列表,請參閱。
/usr/local
如果可以的話,您最簡單的解決方案是安裝 Jekyll 。