LoginSignup
23
23

More than 5 years have passed since last update.

ソースコードからインストールしたGitをアンインストールできない問題

Last updated at Posted at 2015-07-12

問題

さくらVPSのCentOSのソースコードからインストールしたGit(2.3.1)をアンインストールして最新版のGit(2.4.5)をインストールしようとしたところ、アンインストールできなかった。

# cd /usr/local/src/git-2.3.1/
# make uninstall
make: *** ターゲット `uninstall' を make するルールがありません.  中止.
# find . -type f -name "Makefile"
(前略)
./Makefile
(後略)

Makefileはあるけど、Uninstallに関する記述がない?

環境

CentOS 6.6

Git 2.3.1 # アンインストールできなかったバージョン
(インストールディレクトリは $ ./configure --prefix=/usr/local/
と指定した)

解決

適当なディレクトリにもう一度インストールしてみて、その時インストールされたファイルをリストにしてそれを元に消すという方法。

まず、適当なディレクトリを作成し、そこにGitをインストールする。

# mkdir /tmp/test_git
# cd /usr/local/src/git-2.3.1/
# make prefix=/tmp/test_git install

次に、インストールされたファイルをリストとして出力する。

# find /tmp/test_git -type f -print > /tmp/git-installlist.txt

そして、出力されたファイルの全行の /tmp/test_git/usr/local (元のインストールディレクトリ)に置換する。

# vim /tmp/git-installlist.txt
:%s/\/tmp\/test_git/\/usr\/local/g

置換した結果

git-installliset.txt
/tmp/test_git/libexec/git-core/git-send-pack
/tmp/test_git/libexec/git-core/git-am
/tmp/test_git/libexec/git-core/git
(後略)

↓↓↓

git-installliset.txt
/usr/local/libexec/git-core/git-send-pack
/usr/local/libexec/git-core/git-am
/usr/local/libexec/git-core/git
(後略)

最後に、| xargsでgit-installlist.txtの内容をrmに渡してファイルを消す。

# cat /tmp/git-installlist.txt | xargs rm -f

アンインストール完了。
これにて一件落着です。

参考

git - ソースからインストールしたGitのアップデートをしたい - スタック・オーバーフロー

ソースコードからインストールしたGitをアンインストール - Qiita

23
23
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23
23