How to copy file to /usr/share on mac?

16,620

Solution 1

It looks like the problem you are having is more related to installing Vim colorschemes.

Those can be installed in ~/.vim/colors/.

mkdir -p ~/.vim/colors
cp ~/Downloads/kellys.vim ~/.vim/colors/

And then set it with

:colorscheme kellys

Update
If you really want your file in /usr, then the permissions on that folder are on lockdown and you can't edit it without disabling System Integrity Protection (SIP).

A folder that you can modify, however, is /usr/local/share.

So you can instead do

cp ~/Downloads/kellys.vim /usr/local/share/vim/vim73/colors/

Solution 2

U need to disable System Integrity Protection.

  1. restarting and use Command ⌘-R on boot
  2. open a terminal and execute command: csrutil disable
  3. restart normally
  4. NOW u can write in /usr dir tree
  5. (optional) restart again, use Command ⌘-R on boot and execute again csrutil enable
Share:
16,620

Related videos on Youtube

doouding
Author by

doouding

Updated on September 18, 2022

Comments

  • doouding
    doouding over 1 year

    I try to copy some file to /usr/share folder, but the terminal said that operation not permitted even I do the with sudo.
    sudo cp ~/Downloads/kellys.vim /usr/share/vim/vim73/colors/
    the result
    cp: /usr/share/vim/vim73/colors/kellys.vim: Operation not permitted
    When I try to change the permission of this folder, it came with the same problem. I run EI Capitan on Mac. I have google it for a long time,but still confused. How do I solve the problem ?

    • kenorb
      kenorb over 8 years
      Paste exact command that you run and exact output/errors you've got, it'll be easier to understand what you're trying to do.
    • blm
      blm over 8 years
      Being you're running El Capitan, it's probably SIP's fault. You can disable SIP, but a better solution is the one in cricket_007's answer below.
  • doouding
    doouding over 8 years
    thanks, but I really want to figure out this problem.
  • OneCricketeer
    OneCricketeer over 8 years
    Let me know if the update helps
  • Jiraheta
    Jiraheta almost 3 years
    Not sure why it downvoted but this is exactly what I was looking for. I actually needed to add something to /usr/bin not particularly just /usr So, you are back to whole. Thanks.