Install Paramiko on my Mac OS X 10.11
<p>I tried to install paramiko on my Mac OS X 10.11</p>

<p>sudo pip install paramiko</p>

<p>Password:*******</p>

<p>then I got </p>

<pre><code>The directory '/Users/bheng/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/bheng/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting paramiko
  Downloading paramiko-2.0.2-py2.py3-none-any.whl (171kB)
    100% |ââââââââââââââââââââââââââââââââ| 174kB 6.7MB/s 
Requirement already satisfied (use --upgrade to upgrade): pyasn1&gt;=0.1.7 in /Library/Python/2.7/site-packages (from paramiko)
Collecting cryptography&gt;=1.1 (from paramiko)
  Downloading cryptography-1.5.2-cp27-cp27m-macosx_10_10_intel.whl (2.4MB)
    100% |ââââââââââââââââââââââââââââââââ| 2.4MB 568kB/s 
Requirement already satisfied (use --upgrade to upgrade): cffi&gt;=1.4.1 in /Library/Python/2.7/site-packages (from cryptography&gt;=1.1-&gt;paramiko)
Collecting setuptools&gt;=11.3 (from cryptography&gt;=1.1-&gt;paramiko)
  Downloading setuptools-28.0.0-py2.py3-none-any.whl (467kB)
    100% |ââââââââââââââââââââââââââââââââ| 471kB 2.7MB/s 
Requirement already satisfied (use --upgrade to upgrade): six&gt;=1.4.1 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from cryptography&gt;=1.1-&gt;paramiko)
Collecting idna&gt;=2.0 (from cryptography&gt;=1.1-&gt;paramiko)
  Downloading idna-2.1-py2.py3-none-any.whl (54kB)
    100% |ââââââââââââââââââââââââââââââââ| 61kB 10.4MB/s 
Collecting ipaddress (from cryptography&gt;=1.1-&gt;paramiko)
  Downloading ipaddress-1.0.17-py2-none-any.whl
Collecting enum34 (from cryptography&gt;=1.1-&gt;paramiko)
  Downloading enum34-1.1.6-py2-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): pycparser in /Library/Python/2.7/site-packages (from cffi&gt;=1.4.1-&gt;cryptography&gt;=1.1-&gt;paramiko)
Installing collected packages: setuptools, idna, ipaddress, enum34, cryptography, paramiko
  Found existing installation: setuptools 1.1.6
    Uninstalling setuptools-1.1.6:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 736, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 742, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
    copytree(src, real_dst, symlinks=True)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
    raise Error, errors
Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', "[Errno 1] Operation not permitted: '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] Operation not permitted: '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] Operation not permitted: '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")]
</code></pre>

<p>What did I do wrong ? </p>

<p>Any helps on this will be much appreciated ! </p>

<p>Try <code>sudo chown $(whoami) /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/</code>
Then do the same for any directories that Python doesn't have permissions for.</p>

<p>Recent versions of OSX and macOS have a system called System Integrity Protection that means that some directories don't have user permissions. This is in order to prevent the possibility of malware controlling system-central directories, such as <code>/System</code> and <code>/tmp</code>.</p>

<p><strong>EDIT</strong></p>

<p><code>pip install --user paramiko</code> installs the library under the user directory, meaning you won't have problems with permissions. There are other ways to fix this issue with Python consistently, see the comments on this post for more.</p>

python osx paramiko