Posts Tagged command line

Create ipa file for iPhone without signing to Apple (command line)

terminal-iconExporting to ipa file from XCode requires to login to Apple before doing that while you can have already all signing prerequisites locally on your Mac.

You can avoid login if you run the command below from in terminal (you can find the the path to your archive  by right clicking on it in XCode after archiving and “reveal in Finder”):


xcodebuild -exportArchive -archivePath "ArchiveName.xcarchive" -exportPath "ExportedIpaFileName" -exportFormat ipa -exportProvisioningProfile "YourProvisionProfile" ENABLE_BITCODE=YES


, , , , ,

Leave a comment

Step by step tutorial: how to setup new Raspberry PI from command line

Writing image

Connect RPI to Wi-Fi

  • Check wireless connection with “sudo iwlist wlan0 scan”
  • Setup wireless with nano “sudo nano /etc/wpa_supplicant/wpa_supplicant.conf”
  • Add the config below to wpa_supplicant.conf in the end of the file
  • do “sudo ifdown wlan0” then “sudo ifup wlan0”
  • check address with ifconfig

Upgrade RPI to the latest packages, install mc

  • do “sudo apt update”
  • do “sudo apt upgrade”
  • do “sudo apt install mc”
  • set default editor to mcedit “sudo update-alternatives –set editor /usr/bin/mcedit”

Add your own user, configure sudoers, change password of pi

  • add new user with a command “sudo adduser youruser”
  • add the user to sudoers with visudo “sudo visudo”
  • add the following line in the end “youruser ALL=(ALL) NOPASSWD: ALL”
  • change password of pi user “passwd”
  • reboot your RPI with “sudo rpi”

Setup firewall

  • Install ufw with “sudo apt install ufw”
  • Allow minimum ssh ports with “sudo ufw allow 22/tcp”
  • Allow all other port you are going to use, i.e web “sudo ufw allow 80/tcp”
  • Enable ufw “sudo ufw enable”
  • Check the status “sudo ufw status”

Login with your user, fix locales

if you have the issue “warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)”, you can solve it with the command “sudo dpkg-reconfigure locales”, select en_US.UTF-8 as default

Make a backup

  • Make backup with downloaded in the beginning


, , , ,

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

Setup Sublime Text to work with golang and Google App Engine (mac)

If you want to create applications with GO, deploy them to google app engine and use Sublime Text as your IDE then this step-by-step tutorial is for you (tutorial is  for Mac but it can be used for other platforms)

Step 0:

Download and install golang SDK from Google:

Unpack it somewhere (I usually use the folder “$HOME/SDKs”)

Step 1:

Install Sublime Text 3, you can find it here:

Step 2:

Install package control for Sublime Text, find all relevant information about installation process here:

Step 3:

Install GoSublime package:

Press cmd+shift+p, type ‘Package Control: Install Package’ or select it from the list, then type GoSublime and install the package

Step 4:

Setup  variables GOROOT & GOPATH in your environment (put the information below into .bash_profile on Mac/Linux)

Type in command line

cd ~
open .bash_profile -a "Sublime Text"

And add following lines to the end of the file

# Change the variables below to the path where you installed go_appengine
export GOSDK=/Users/user/SDKs/go_appengine
export GOROOT=$GOSDK/goroot
export GOPATH=$GOSDK/gopath

Step 5:

Go to $GOROOT/bin & $GOROOT/pkg folders and execute the a commands below to create appropriate symlinks (GoSublime does not know anything about ‘goapp’, it knows only about ‘go’, we should simulate it)

cd $GOROOT/bin
ln -s goapp go
cd $GOROOT/pkg
ln -s darwin_amd64_appengine darwin_amd64

Step 6:

Create your first go app for GAE: create folder somewhere and create there 2 files, hello.go with the following content

package hello

import (

func init() {
    http.HandleFunc("/", handler)

func handler(w http.ResponseWriter, r *http.Request) {
    fmt.Fprint(w, "Hello, world!")

and app.yaml with the following content (change gae-app-name-hello to real gae ID before deploying!)

application: gae-app-name
version: 1
runtime: go
api_version: go1

- url: /.*
  script: _go_app

If you did everything correctly then your Sublime Text should have code completion and console to run go commands. Press in Sublime Text cmd+9 and type ‘build’ in the console, it should compile and build your app. If build is successful then go to terminal and type in the app folder ‘goapp serve’, the app will run locally, you can check it with your web browser on the link http://localhost:8080

Step 7:

Deploy your app using command ‘goapp deploy’ in your app folder (do not forget to perform all the prerequisites to setup app engine, check this link for more info:


, , , , , , ,

Leave a comment

Login with SSH without password (Mac, Linux)

1. Go to computer where you want to connect from. Check the folder $HOME/.ssh/, if there is a file then skip this step. Otherwise generate generate new rsa keys using the following command:

ssh-keygen -t rsa

2. Go to computer where you want to connect with ssh to. Check the folder $HOME/.ssh/, if it exists then skip this step otherwise create new one with the command:

mkdir -p .ssh

3. Go back to computer where you want to connect from and use the command below to copy public key, it will ask your password for the last one time:

cat ~/.ssh/ | ssh user_on_remote_computer@remote_computer_host  'cat >> ~/.ssh/authorized_keys'

4. We are ready! Connect without entering password:

ssh user_on_remote_computer@remote_computer_host



Leave a comment

Delete local and remote branches, sync deleted branches

Show all the branches (local and remote) tracked in the local git repository:

git show-branch --all

Delete local branch:

git branch -d local_branch

If remote branch was deleted, it is still tracked locally, to remove from local tracking do the following:

git fetch -p

The command will delete (-p – prune) locally tracked branches which do not exist remotely


Leave a comment