岡竜之介のブログ

岡竜之介のブログです。

Macの容量を空ける!Get more space on the Mac storage!!

f:id:agajo:20161115054848p:plain


ぎゃあああああああああああ
Aaaaaaaaaa




残り容量が、ほとんどないいいいいいいいいい
There is little remaining capacity


このMacは僕が休学してた夏に買ったものなので、4年と1クォーターほど使ってるものです。
I bought this Mac in the summer I was off. It is four years and one quarter ago.




SSDなので容量が小さいことは覚悟していたのですが、いよいよいっぱいになってきましたね。
Since it is SSD, I was prepared to have small capacity. It is finally becoming full.


まあ4年も使えばそうなるか。長く保ったほうだろ。
It will be so if used for 4 years. It can be said that it kept it long enough.


この容量を、空けよう!!!!!
Let's make more of this capacity!



ということで、今回は、この記事に実際に書き込みながら、リアルタイムに作業を進めていきたいと思います。
So I would like to continue working while writing to this article.



リアルタイムに公開はしないから、読む人は一気に読むわけだけどね!!
Because it does not publish in real time, readers read in one stroke though! !



準備 Preparation

外付けHDDを用意しました。
I prepared an external HDD.


f:id:agajo:20161115061933p:plain


…外付けHDDもそこそこいっぱいなのかよ。
...The HDD is also almost full....


パーティションが切ってあって、半分はバックアップ「Time Machine」に当ててあります。
It's divided into 2 partitions. One of them is for "Time Machine".


残りの半分は、ほとんど動画ですね。
The other one has movies.


鏡はどうして左右が逆転するのかを、わかりやすく一発解説|オブジェクション!の提案【ユーチューバー】

これ僕らの動画です。
It's our movie.


こういうのの素材動画が全部入ってるので、重いです。
There are stock videos here. heavy.


つーか、この"Time Machine"の方にこのMacの中身がまるまるバックアップされてるはずだから
In "Time Machine", there must be the whole data of the Mac.


このMacの方はほとんどまるまる消しても大丈夫なんじゃね?
Can't I delete most data in the Mac?


そういうの自動的にやってくれないのかな。
And, can't it do it automatically?

ちょっとわからんわ。
I don't know.


とりあえず、作業を開始しよう。
Let's begin.

仮説①動画や写真や音楽などが容量を圧迫している

Assumption 1. Movies, Pictures and Musics occupy the storage.


f:id:agajo:20161115054848p:plain


これを見ればわかるんですけど、この仮説は間違ってますね。
As you can see, this assumption is not correct.


Others って何だよ!!!!!!!
What are "Others" !!!!!


いや確かにPhotosとAudioとMovies合わせて10GBくらいあるけど、先に攻めるべきはこのOthersでしょう。
It is true that Photos, Audio and Movies are about 10GB, but I should process "Others" first.

仮説②過去にインストールしたいろいろな開発環境が容量を食っている

Assumption 2. The sizes of development environments that I installed in the past are large.


多分これだと思うんですよね。
I think it's true.


この4年間にこのMacにはいろんなものをインストールしました。
I installed a lot of things in this Mac for the past four years.


PHPとかCakePHPとかOctaveとかHaskell(GHC)とかPython2.7とかPython3.5とかRとかRStudioとかXQuartsとか。
PHP, CakePHP, Octave, Haskell(GHC), Python2.7, Python3.5, R, RStudio, XQuarts, etc...


そういうのが蓄積してるんじゃないかな。
I think they are accumulating.


それもHomebrewで入れたり、同じ奴を独立に入れたりして、多分もうぐっちゃぐちゃだと思うんですよね。
Some times I used Homebrew, and I installed the same thing without Homebrew.


もはや brew doctor や brew update すら正常に動かないもん。
Commands like "brew doctor" and "brew update" don't work.

Macに作ったいらないアカウントを消す

Remove the accounts from the Mac


研究とか就活をする時に、作業スペースを分けようと思ってそれ用のアカウントをMac上に作ったんですよ。
I made these accounts when I did my research and when I was finding a job in order to divide the work spaces.


そのアカウントから何かをインストールした結果、権限関係がめちゃくちゃになってます。
I've installed things by these accounts. As a result, the relationship of permissions is messed up.


なのでそれを消します。
Let's delete these accounts.


f:id:agajo:20161115064231p:plain


容赦なくいきましょう。
no mercy.


f:id:agajo:20161115064505p:plain

お、ちょこっと空いた。
I was able to empty a little



多分これでHomebrewが動かせるだろう。そしたらいらないものをアンインストールしていこう。
I think Homebrew works now. After that, let's uninstall unnecessary things.

brew update 

をして…
and...


f:id:agajo:20161115070340p:plain



はい、動かない。
OK. It doesn't work.

地道に一つずつ確認していく

Check files one by one.


結局、これしかないですね。
This is the only way.

easyramble.com


このやり方を参考に、何が容量を食ってるか調べていこう。時間かかるけど。
Let's examine which file size is large referring to this method. It takes time though.

sudo du -sh /*

結構時間がかかるので待ちます。1時間くらい?
It takes time and I have to wait for about an hour.

22G	/Applications
 10G	/Library
  0B	/Network
6.7G	/System
 46G	/Users
 26G	/Volumes
2.5M	/bin
  0B	/cores
4.5K	/dev
4.0K	/etc
1.0K	/home
4.0K	/installer.failurerequests
1.0K	/net
175M	/opt
6.7G	/private
1.0M	/sbin
4.0K	/tmp
3.3G	/usr
4.0K	/var
4.0K	/ユーザ情報

なるほど。(他にも謎のメッセージがガンガンでたけど、無視してます。)
I see. (There were other messages, but I ignored them.)


まずはUsersから攻めていこう。
Let's attack "Users" first.

sudo du -sh /Users/*
557M	/Users/Shared
 45G	/Users/username
sudo du -sh /Users/username/*
4.0K	/Users/username/-help
 44M	/Users/username/Applications
4.6M	/Users/username/Creative Cloud Files
 16M	/Users/username/Creative Cloud Files (archived) (1)
 12M	/Users/username/Desktop
6.7G	/Users/username/Documents
1.8G	/Users/username/Downloads
 31G	/Users/username/Library
1.0G	/Users/username/Movies
1.6G	/Users/username/Music
2.0G	/Users/username/Pictures
8.0K	/Users/username/Public
148M	/Users/username/Sites
4.0K	/Users/username/leksah.lkshs
4.0K	/Users/username/leksah.lkshw
 20K	/Users/username/line-log
1.9M	/Users/username/octave

Documentsは僕の普段の作業フォルダです。ここに手をいれるとなると、いよいよちゃんと1つずつ見ていかなきゃいけないので一旦放置。
"Documents" is my working folder.


手をいれるべきは、Libraryですね。
I should attack "Library".


以下同様に、一番大きなフォルダを順に掘り下げていくと…
Similarly, as I dig down the biggest folder in order ...

sudo du -sh /Users/username/Library/Application\ Support/Adobe/Common/*
  0B	/Users/username/Library/Application Support/Adobe/Common/Anywhere Cache
820K	/Users/username/Library/Application Support/Adobe/Common/Media Cache
 16G	/Users/username/Library/Application Support/Adobe/Common/Media Cache Files
 44K	/Users/username/Library/Application Support/Adobe/Common/MediaCoreQTCodecRulesCC 2014.xml
 48K	/Users/username/Library/Application Support/Adobe/Common/MediaCoreQTCodecRulesCC 2015.xml
 44K	/Users/username/Library/Application Support/Adobe/Common/MediaCoreQTCodecRulesCC 2018.xml


ア…アドビだ……アドビのキャッシュだ…
A...Adobe.....Adobe cache....


キャッシュと名のつくものは消していい気がするけど、一応中身を確認。
I think I can delete "cache" folder, but let me check it first.


…とここでエラー。
Error.

sudo du -sh /Users/username/Library/Application\ Support/Adobe/Common/Media\ Cache\ Files/*
sudo: unable to execute /usr/bin/du: Argument list too long


引数が長すぎるらしい。cdで移動して、中身を確認すると…
Argument list is too long. Let me change the current directly by "cd".





プライバシーのアレで見せられませんが、大量のファイルが出てきました。
There were a lot of files. I can't show you them because of my privacy.


タイトルも見覚えがある。
These titles are familiar.


なるほど。動画編集するたびにここにキャッシュがたまっていってたんだな。
I see. Every time I edited a video they were cached here.


まあキャッシュだし、消して大丈夫だろう!!
I think I can delete cache files!!

sudo rm -R ./*

※pwdで現在地を確認して万全の注意を払って削除。
※Use pwd and check where you are before "rm".


f:id:agajo:20161115080847p:plain


おお〜〜。やるじゃん。
Good.



以下、そんな感じで容量のでかいものを調べながら消していきました。
In the same way, I extinguished while examining the large capacity.

2.4G	./Users/username/Library/Application Support/Steam

steamじゃん〜〜 Her Storyというゲームをプレイしていたのですが、もう終わったので削除。
steam. I played "Her Story". I can delete this because it's done.

Removing and Reinstalling Steam on a Mac - Mac Issues - ナレッジベース - Steam Support

2.1G	./Users/username/Library/Caches/Google Earth

GoogleEarthのキャッシュでかいな。削除。
Google Earth's cache files are large. delete.




Applicationsは容量食ってるけどなかなか消せないな〜
Applications are large, but I can't delete these...



Garage Bandの楽器の音のファイルは消せないな〜
Garage Band Instrumental Files aren't able to be deleted...



フォントも消せないな〜
I can't delete Font files, neither...

2.0G	/System/Library/Caches/com.apple.coresymbolicationd

こんなの怖くて消せないよ〜
This file looks important...




…とかやって結局…
And...



f:id:agajo:20161115091548p:plain


う…うん…。
ah, ok...


まあ、そこそこ空いた、かな…。
I think it's not so bad...


Adobe Premiere で動画編集するとキャッシュファイルがガンガン貯まるんですね。
Adobe Premiere stores cache files so much.


消しちゃったけど大丈夫かな。
I've deleted them. Is it ok?



ということで。
OK.



でかい動画や音楽や写真をあまりパソコンに入れないように使ってきたので、いざいっぱいになると容量を空けるのが大変でした。
Because I used this computer without saving large files such as movies and musics, It was difficult to get back the capacity.


次にいっぱいになったらいよいよ細かいもの一つ一つ消していかないと厳しいだろうな。
It will be more difficult next time.


ちなみにこれだけ空けるだけで4時間くらいかかってます。容量の大きなファイルを調べ、それが何か調べ、消していいか調べ…とやらなきゃいけないので大変ですね。
It took about 4 hours. Checking which file is large, what is it and whether I can delete it or not. It was tough.



And writing this article in English took 1 or 2 hours lol


追記 Addition

f:id:agajo:20161115110839p:plain
再起動したら結構空いた。
After restarting Mac, I got more.