Posts Tagged Mac

Cannot recover macOS High Sierra?

I ran into this issue when tried to recover old macbook air with lost admin password. Choosing recovery did not help as it always ended with error message “recovery server could not be contacted”.

As I discovered it happened because macbook time was not in sync with apple servers, so the following command in terminal helped to resolve the issue:

ntpdate -u


, , ,

Leave a comment

Space disappearing on Mac

One day I noticed that the free space started to disappear on my macbook pro (and even deleting files did not free any byte), I had a difference in 100Gb  between the commands `sudo du -shg /` (space used) and `df -h` (actually free available space).  After hours of googling I’ve managed finally to fix the issue (found out that the space disappeared because my time machine worked in a wrong way ) doing the following

  • Disabling time machine in System Preferences
  • Using command line utility tmutil `tmutil thinlocalsnapshots / 1000000000 1` to shrink the space used by time machine
  • Rebooting the mac into the save mode and staying there for about 5 minutes

Making that note just in case I have that problem again to spare the time but in hope that I do not need to use it anymore ( but probably it will help somebody else). I faced this time machine issue first time for 7 years of Macbook usage 😦

, , , , , , , ,

Leave a comment

Fixing not working auto-completion for golang in Visual Studio Code

gophervsMy favorite code editor for GO  (Visual Studio Code with Go extenstion from lukehoban) on my Mac sometimes loses its intelligent behavior when suddenly code completion stops to work.

Usually just couple of commands in terminal recovers auto-completion back to life:

  1. Close Visual Studio Code
  2. Open terminal and stop gocode with gocode close
  3. Update gocode with the command `go get -u`
  4. Start Visual Studio Code again and enjoy.

, , , , , ,

Leave a comment

Reinstall formula with brew from scratch


brew uninstall --force formula_name

Clear versions & cache

brew cleanup --force -s formula_name

Remove dead symbolic links

brew prune formula_name

Install again

brew install formula_name

Enjoy 🙂

, ,

Leave a comment

Delete certificates from System Roots in Keychain Access on Mac

Before you start deleting certificates from System Roots in your Keychain Access, make sure that you know what you are doing as you can harm your mac if you will delete some essential certificates.

You have been warned 🙂

1. Reboot mac in recovery mode (Hold cmd+R) during restart

2. Start terminal and switch off System Integrity Protection running the command

csrutil disable

3. Reboot in normal mode

4. Start keychain access and find the certificates you want to delete, check its name or unique fingerprint (Right click -> Get info -> Common name or SHA1)

5. Use command line below to delete the certificate using common name:

sudo security delete-certificate -c Common-Name /System/Library/Keychains/SystemRootCertificates.keychain

Or command line below if you are using SHA1 (delete all the spaces in SHA1 fingerprint before running the command)

sudo security delete-certificate -Z SHA1-fingerprint /System/Library/Keychains/SystemRootCertificates.keychain

6. Reboot your mac in recovery mode again (Hold cmd+R)

7. Start terminal and switch on System Integrity Protection running the command

csrutil enable

8. Reboot in normal mode

, , , , , , , , ,

Leave a comment

Using standard command “go get” for private golang packages on

I’m keeping my projects privately on and want to use for some of my golang packages standard “go get” command instead of using git clone/pull. When I’m trying to use standard commands I’m getting the error

go get
# cd .; git clone /home/bykov/gopath/src/
Cloning into '/home/bykov/gopath/src/'...
fatal: could not read Username for '': terminal prompts disabled

As I’m using SSH keys to access the git repository, the following command solves the issue giving possibility to use standard go packages commands

git config --global url."".insteadOf ""

You can check if it was applied using the following command

cat ~/.gitconfig

The output of the command above should be like the text below

[url ""]
    insteadOf =

The command

go get

is working now.

PS. The same solution is working for

, , , , , , , ,

Leave a comment

Starting command line program/script in background as job (Linux, Mac)

It is important to  use the command “nohup” and also redirect everything, otherwise the job will be killed after leaving console

nohup ./your_program_or_script_here > copyout.log 2> copyout.err < /dev/null &

On the other side, if you need just to run something in background because you are afraid that you will loose the session, the best way for it is using tmux, it can be installed with “apt-get install tmux” in Ubuntu Linux or “brew install tmux” on Mac

Open new session:

tmux new -s session_name

Attach to the lost session:

tmux attach -t session_name

, , , , ,

Leave a comment