OSX HD Cleanup for Developers

So you are an iOS Developer and Mac user, ain’t it? I’ll show you some tips I use to reclaim my HD space [=

As a Mac user you shold have TimeMachine enabled in order to keep your things backed-up .

You should know that Time Machine has by default the Automatic Backup enabled that takes some snapshots also on local storage waiting for a full backup on your external HD.

It’s show time, so open up a Terminal window!

To see these snapshots you do:

sudo tmutil listlocalsnapshots /
sudo tmutil listlocalsnapshots /
com.apple.TimeMachine.2018-10-02-150623
com.apple.TimeMachine.2018-10-03-120519
com.apple.TimeMachine.2018-10-03-130357
com.apple.TimeMachine.2018-10-03-140849
com.apple.TimeMachine.2018-10-03-150352

In order to delete a local snapshot you have to type:

sudo tmutil deletelocalsnapshots 2018-10-02-150623
sudo tmutil deletelocalsnapshots 2018-10-02-150623
Deleted local snapshot '2018-10-02-150623'

Were you used to disable localsnapshots, do you say?

With OSX High Sierra+ you cannot. (Without disabling automatic backups). Correct me if I’m wrong.

Anyway, if you need to reclaim some of your HD space you could delete all local snapshots in one shot:

sudo tmutil listlocalsnapshots / | sed 's/com.apple.TimeMachine.//g' | xargs -I % sudo tmutil deletelocalsnapshots %
$ sudo tmutil listlocalsnapshots / | sed 's/com.apple.TimeMachine.//g' | xargs -I % sudo tmutil deletelocalsnapshots %
Deleted local snapshot '2018-10-03-130357'
Deleted local snapshot '2018-10-03-140849'
Deleted local snapshot '2018-10-03-150352'
Deleted local snapshot '2018-10-03-160946'

Another trick you could use is to delete all the old Device Debug Support symbols that Xcode download every time you connect a new physial device to your Mac with a new iOS Version. So you will have, for example, debug symbols for 10.3, 10.3.1, 10.3.2, …, 11.0.0, 11.1.0, …, 11.4.1, … and so on.

This symbols are stored in the following directory:

~/Library/Developer/Xcode/iOS DeviceSupport/

Let’s check it out by entering the above directory and typing:

find . -type f -size +1G | xargs -I % du -h %

You sould see some big files (more than 1 giga):

find . -type f -size +1G | xargs -I % du -h %

1.0G ./11.3 (15E216)/Symbols/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64

1.0G ./11.4 (15F79)/Symbols/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64

1.0G ./11.3.1 (15E302)/Symbols/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64

1.0G ./11.2.5 (15D60)/Symbols/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64

1.0G ./11.4.1 (15G77)/Symbols/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64

1.0G ./11.2.6 (15D100)/Symbols/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64
If you need them no more… delete’em all! (or only the ones you need no more [=)
Hope this tips could be of any help to you. Let me know your tips if you do have different ones!
Bye!
OSX HD Cleanup for Developers

Visualizzare i file nascosti in Mac OSX

mac_osx

 

Aprite il terminale e digitare

defaults write com.apple.finder AppleShowAllFiles YES

Premete invio.

Poi rilanciate il finder cliccando con il pulsante destro + tasto option e scegliendo “rilancia (relaunch)”.

Per nascondere nuovamente i file nascosti, sempre da terminale

defaults write com.apple.finder AppleShowAllFiles NO
Visualizzare i file nascosti in Mac OSX

Abilitare la connessione remota ad MySql

mysql

 

Per abilitare l’accesso remoto al vostro database MySql non dovete solo dare i diritti ad un utente (e.g remoteuser) ad un certo indirizzo (xxx.xxx.xxx.xxx)

grant all privileges on *.* to remoteuser@xxx.xxx.xxx.xxx

Dovete anche commentare la seguente riga di codice nel file .my.cnf e riavviare il servizio mysql.

#bind 127.0.0.1
Abilitare la connessione remota ad MySql

Redirect SEO Compliant all’indirizzo .com per Apache

Per configurare correttamente il nostro VirutalHost di Apache in modo che se per esempio andiamo all’indirizzo

www.miosito.it

o

www.miosito.eu

o

www.miosito.net

vogliamoi essere rediretti all’url principale

www.miosito.com

Per essere SEO complianto occorre avere questa configurazione:

<VirtualHost *:80>
  ServerName www.miosito.it
  ServerAlias www.miosito.eu
  ServerAlias www.miosito.net
  RedirectMatch 301 (.*) http://www.miosito.com$1
</VirtualHost>

<VirtualHost *:80>
  DocumentRoot /var/www/html/miosito
  ServerName www.miosito.com
</VirtualHost>
Redirect SEO Compliant all’indirizzo .com per Apache