無能エンジニアの備忘録

しがない学生の備忘録です

HighSierraにアプデしたらvimが起動できなかった

macをHigh Sierraにアプデしたんですが、コンソールでvimを起動したらこんなメッセージが

dyld: Library not loaded: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib
  Referenced from: /usr/local/bin/vim
  Reason: image not found

ググると先人さまの知恵がありました。

shinogasa.hatenablog.com

swiftfe0.hatenablog.com

とりあえず色々アプデする必要がある模様。

まずpythonをアプデしようとしたら

$ brew upgrade python
Updating Homebrew...
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core, caskroom/cask).
==> New Formulae
avimetaedit           bedtools              cling                 clingo                docker-ls             envconsul             mrboom                raylib                sceptre
==> Updated Formulae
little-cms2 ✔       checkstyle          fail2ban            gitlab-runner       kontena             libuv               nghttp2             pyvim               shfmt               uncrustify
sbt ✔               clhep               firebase-cli        gmime               kotlin              libwps              nmh                 q                   sile                urh
abcm2ps             cmake               fish                gradle-completion   kubernetes-cli      lldpd               node-build          qca                 sip                 vcdimager
angular-cli         conan               fluent-bit          grails              kvazaar             mapnik              nuget               qscintilla2         skinny              wireguard-tools
arangodb            conjure-up          fn                  gx                  ldc                 mediaconch          ocamlbuild          qt                  sslyze              xonsh
armadillo           consul              fonttools           gx-go               libatomic_ops       mgba                opencbm             rancher-cli         stormlib            xxhash
aspcud              convmv              freetds             hana                libcddb             micro               overmind            rebar@3             swi-prolog          youtube-dl
aurora-cli          cppad               fwup                hivemind            libcdio             midnight-commander  paket               remake              swiftformat         zanata-client
awscli              docker              gauge               huexpress           libcouchbase        minio               pandoc              rocksdb             termius             zimg
azure-cli@1         docker-completion   gdnsd               ibex                libdivecomputer     miniupnpc           parallel            roswell             terragrunt
bacula-fd           efl                 gegl                iso-codes           libgosu             mockserver          passenger           rust                tgui
blink1              ejabberd            geoserver           jhipster            libhttpseverywhere  mono-libgdiplus     pegtl               scalariform         thefuck
bmake               erlang              geth                knot                libmaxminddb        mpd                 percona-toolkit     sdl2_mixer          tidy-html5
bwfmetaedit         etsh                ghc                 kobalt              librealsense        multimarkdown       plzip               sfk                 tippecanoe
bzt                 exim                git-annex           kompose             libsass             nativefier          pyqt                shairport-sync      traefik
==> Deleted Formulae
clasp                                                                                                gringo

==> Upgrading 1 outdated package, with result:
python 2.7.14
==> Upgrading python
Error: The following formula:
  python
cannot be installed as a binary package and must be built from source.
Install the Command Line Tools:
  xcode-select --install

なんかこけた

xcodeコマンドラインツールないよって言われたので xcode-select --install 実行 そしたらポップアップでウィンドウが出てきたのでそのままインストール

もう一回実行してちゃんとインストールされたか確認

$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

されてますね。

~ brew upgrade python
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (caskroom/cask).
No changes to formulae.

==> Upgrading 1 outdated package, with result:
python 2.7.14
==> Upgrading python
==> Installing dependencies for python: sqlite, openssl
==> Installing python dependency: sqlite
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.21.0.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring sqlite-3.21.0.high_sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/sqlite/lib
    CPPFLAGS: -I/usr/local/opt/sqlite/include
For pkg-config to find this software you may need to set:
    PKG_CONFIG_PATH: /usr/local/opt/sqlite/lib/pkgconfig

==> Summary
🍺  /usr/local/Cellar/sqlite/3.21.0: 11 files, 3.0MB
==> Installing python dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2m.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.2m.high_sierra.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include
For pkg-config to find this software you may need to set:
    PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig

==> Summary
🍺  /usr/local/Cellar/openssl/1.0.2m: 1,792 files, 12.3MB
==> Installing python
==> Downloading https://homebrew.bintray.com/bottles/python-2.7.14.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring python-2.7.14.high_sierra.bottle.tar.gz
==> /usr/local/Cellar/python/2.7.14/bin/python2 -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --record=installed.txt --install-scripts=/usr/local/Cellar/pytho
==> /usr/local/Cellar/python/2.7.14/bin/python2 -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --record=installed.txt --install-scripts=/usr/local/Cellar/pytho
==> /usr/local/Cellar/python/2.7.14/bin/python2 -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --record=installed.txt --install-scripts=/usr/local/Cellar/pytho
==> Caveats
This formula installs a python2 executable to /usr/local/bin.
If you wish to have this formula's python executable in your PATH then add
the following to ~/.bash_profile:
  export PATH="/usr/local/opt/python/libexec/bin:$PATH"

Pip and setuptools have been installed. To update them
  pip2 install --upgrade pip setuptools

You can install Python packages with
  pip2 install <package>

They will install into the site-package directory
  /usr/local/lib/python2.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python.html
==> Summary
🍺  /usr/local/Cellar/python/2.7.14: 3,325 files, 45.5MB

成功しました。

続いてvimのアップグレード

 ~ brew upgrade vim
==> Upgrading 1 outdated package, with result:
vim 8.0.1300
==> Upgrading vim --with-override-system-vi --with-python3 --with-lua
==> Installing dependencies for vim: python3
==> Installing vim dependency: python3
==> Downloading https://homebrew.bintray.com/bottles/python3-3.6.3.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring python3-3.6.3.high_sierra.bottle.tar.gz
==> /usr/local/Cellar/python3/3.6.3/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.6.3/bin --install-lib=/usr/local/lib/python3.6/site-pa
==> /usr/local/Cellar/python3/3.6.3/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.6.3/bin --install-lib=/usr/local/lib/python3.6/site-pa
==> /usr/local/Cellar/python3/3.6.3/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.6.3/bin --install-lib=/usr/local/lib/python3.6/site-pa
==> Caveats
Pip, setuptools, and wheel have been installed. To update them
  pip3 install --upgrade pip setuptools wheel

You can install Python packages with
  pip3 install <package>

They will install into the site-package directory
  /usr/local/lib/python3.6/site-packages

See: https://docs.brew.sh/Homebrew-and-Python.html
==> Summary
🍺  /usr/local/Cellar/python3/3.6.3: 3,359 files, 53MB
==> Installing vim --with-override-system-vi --with-python3 --with-lua
==> Downloading https://github.com/vim/vim/archive/v8.0.1300.tar.gz
==> Downloading from https://codeload.github.com/vim/vim/tar.gz/v8.0.1300
######################################################################## 100.0%
==> ./configure --prefix=/usr/local --mandir=/usr/local/Cellar/vim/8.0.1300/share/man --enable-multibyte --with-tlib=ncurses --enable-cscope --enable-terminal --with-compiledby=Homebrew --enable-luain
==> make
==> make install prefix=/usr/local/Cellar/vim/8.0.1300 STRIP=/usr/bin/true
🍺  /usr/local/Cellar/vim/8.0.1300: 1,424 files, 22.8MB, built in 1 minute 36 seconds

ちゃんと8.xでアップグレードされていますね。 しかし、依存関係で取ってきているのはpython3.6・・・ もしかしてpythonのアップグレード関係なかった・・・?

まぁとりあえず動いているので良しとしましょう。