ハイパーマッスルエンジニア

Vim、ShellScriptについてよく書く

Carthageをupgradeしてもバージョンが変わらない

f:id:rasukarusan:20190815022309p:plain:w500

carthageのバージョンを確認すると最新にしろと言われていたのでbrew upgrade carthageしたが、 何故かバージョンが上がらない。

# 最新に上げろと言われる
$ carthage version
Please update to the latest Carthage version: 0.33.0. You currently are on 0.26.0
0.26.0

# HomebrewでCarthageのバージョン確認しても「最新」と出る
$ brew upgrade carthage
Error: carthage 0.33.0 already installed

Carthageの参照先が違うっぽかった

対処法

$ brew unlink carthage
Unlinking /usr/local/Cellar/carthage/0.33.0... 0 symlinks removed

$ which carthage
/usr/local/bin/carthage

$ rm /usr/local/bin/carthage

$ brew install carthage
Updating Homebrew...
Warning: carthage 0.33.0 is already installed, its just not linked
You can use `brew link carthage` to link this version.

$ brew link carthage

$ carthage version
0.33.0

Carthageが最新じゃないとインストールできないライブラリもある(?)

Carthageが0.26のときにライブラリをインストールしようとすると下記のようなエラーが出た。

$ carthage update --platform iOS

*** Building scheme "HGCircularSlider" in HGCircularSlider.xcworkspace
Failed to write to /Users/iam/Desktop/testapp/Carthage/Build/iOS/HGCircularSlider.framework: Error Domain=NSCocoaErrorDomain Code=260 "The file “HGCircularSlider.framework” couldn’t be opened because there is no such file." UserInfo={NSURL=file:///Users/iam/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2_10E125/HGCircularSlider/2.2.0/Build/Intermediates.noindex/ArchiveIntermediates/HGCircularSlider/BuildProductsPath/Release-iphoneos/HGCircularSlider.framework, NSFilePath=/Users/iam/Library/Caches/org.carthage.CarthageKit/DerivedData/10.2_10E125/HGCircularSlider/2.2.0/Build/Intermediates.noindex/ArchiveIntermediates/HGCircularSlider/BuildProductsPath/Release-iphoneos/HGCircularSlider.framework, NSUnderlyingError=0x7fc74fc02830 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

0.33にアップグレードしたら無事インストールできた。

終わり

今のMacにどうやってCarthageをインストールしたか忘れてしまったが、HomebrewでインストールしたCarthageを参照していなかった。
Carthageはbrewの他にMacPortでもインストールできるのでそっちでやっちゃったのかなあ。