Vagrantをアンインストールした時のメモです。
環境
Vagrant 1.9.5
手順
まずはVagrantのVMの状態を確認。
1 2 3 4 5 6 7 8 9 10 11 |
$ vagrant global-status id name provider state directory ------------------------------------------------------------------------- 36ee30d default virtualbox poweroff /Users/ringo/Vagrant/centos6 The above shows information about all known Vagrant environments on this machine. This data is cached and may not be completely up-to-date. To interact with any of the machines, you can go to that directory and run Vagrant, or you can use the ID directly with Vagrant commands from any directory. For example: "vagrant destroy 1a2b3c4d" |
表示されたVMを削除。
1 2 3 4 5 6 7 8 9 |
$ vagrant destroy 36ee30d default: Are you sure you want to destroy the 'default' VM? [y/N] y ==> default: Destroying VM and associated drives... $ vagrant global-status id name provider state directory -------------------------------------------------------------------- There are no active Vagrant environments on this computer! Or, you haven't destroyed and recreated Vagrant environments that were started with an older version of Vagrant. |
次にboxの削除。
1 2 3 4 5 6 |
$ vagrant box list bento/centos-6.8 (virtualbox, 2.3.4) $ vagrant box remove bento/centos-6.8 Removing box 'bento/centos-6.8' (v2.3.4) with provider 'virtualbox'... $ vagrant box list There are no installed boxes! Use `vagrant box add` to add some. |
そしてVagrantを削除します。
今回はインストール時のdmgファイルに入っている「uninstall.tool」を使いましたが、
手動で消しても問題ないと思います。
まず「uninstall.tool」を右クリックして「開く」を選択します。
すると、「“uninstall.tool”の開発元は未確認です。開いてもよろしいですか?」
と聞かれるので、「開く」を選択します。
ターミナルが開き、確認を求められるので「Yes」を入力します。
さらにパスワードも求められるので入力します。
最後に何かキーを押して終了です。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
$ /Volumes/Vagrant/uninstall.tool ; exit; The following files and directories will be removed: /opt/vagrant /usr/local/bin/vagrant Do you wish to uninstall Vagrant (Yes/No)? Yes The uninstallation process requires administrative privileges because some of the installed files cannot be removed by a normal user. You may now be prompted for a password... Successfully uninstalled Vagrant. Done. Press any key to exit. logout Saving session... ...copying shared history... ...saving history...truncating history files... ...completed. [プロセスが完了しました] |
これで
- /opt/vagrant
- /usr/local/bin/vagrant
が削除されました。
あと、公式ページをみるとパッケージ情報とユーザデータの削除が必要です。
まずはパッケージ情報。
1 2 3 4 5 6 7 |
$ pkgutil --pkgs | grep -i vagrant com.vagrant.vagrant $ sudo pkgutil --forget com.vagrant.vagrant Password: Forgot package 'com.vagrant.vagrant' on '/'. $ pkgutil --pkgs | grep -i vagrant $ |
続いてユーザデータ。
1 2 3 4 5 6 |
$ ls ~/.vagrant.d/ boxes gems plugins.json setup_version data insecure_private_key rgloader tmp $ rm -r ~/.vagrant.d/ $ ls ~/.vagrant.d/ ls: /Users/ringo/.vagrant.d/: No such file or directory |
あとは「vagrant init」した時のVagrantfileやディレクトリなどを削除したら完了です。
以上、Vagrantのアンインストールでした。