Skip to content

Instantly share code, notes, and snippets.

@maks
Last active October 8, 2018 04:09
Show Gist options
  • Select an option

  • Save maks/5e693239acf44a70636893e7d3458016 to your computer and use it in GitHub Desktop.

Select an option

Save maks/5e693239acf44a70636893e7d3458016 to your computer and use it in GitHub Desktop.
Linux Users guide to setting up OSX for comfortable Android development
alias gs='git status'
alias gd='git diff'
alias gc='git commit'
alias ga='git add'
alias gb='git branch'
alias gcb='git checkout -b'
alias gdc='git diff --cached'
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
export ANDROID_HOME=/Users/$USER/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools
. ~/.bash_aliases
. ~/.git_ps1
# From: https://digitalfortress.tech/tutorial/setting-up-git-prompt-step-by-step/
# Colours and ps content changes by me. -Maks.
# store colors
MAGENTA="\[\033[0;35m\]"
YELLOW="\[\033[01;32m\]"
BLUE="\[\033[00;34m\]"
LIGHT_GRAY="\[\033[0;37m\]"
CYAN="\[\033[0;36m\]"
GREEN="\[\033[00m\]"
RED="\[\033[0;31m\]"
VIOLET='\[\033[01;35m\]'
function color_my_prompt {
local __user_and_host="$GREEN\u@\h"
local __cur_location="$GREEN\W" # capital 'W': current directory, small 'w': full file path
local __git_branch_color="$GREEN"
local __prompt_tail="$BLUE$"
local __user_input_color="$GREEN"
local __git_branch='$(__git_ps1)';
# colour branch name depending on state
if [[ "$(__git_ps1)" =~ "*" ]]; then # if repository is dirty
__git_branch_color="$RED"
elif [[ "$(__git_ps1)" =~ "$" ]]; then # if there is something stashed
__git_branch_color="$YELLOW"
elif [[ "$(__git_ps1)" =~ "%" ]]; then # if there are only untracked files
__git_branch_color="$LIGHT_GRAY"
elif [[ "$(__git_ps1)" =~ "+" ]]; then # if there are staged files
__git_branch_color="$CYAN"
fi
# Build the PS1 (Prompt String)
PS1="$__cur_location$__git_branch_color$__git_branch $__prompt_tail$__user_input_color "
}
# configure PROMPT_COMMAND which is executed each time before PS1
export PROMPT_COMMAND=color_my_prompt
# if .git-prompt.sh exists, set options and execute it
if [ -f ~/.git-prompt.sh ]; then
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWSTASHSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
GIT_PS1_SHOWUPSTREAM="auto"
GIT_PS1_HIDE_IF_PWD_IGNORED=true
GIT_PS1_SHOWCOLORHINTS=true
. ~/.git-prompt.sh
fi
# Install Tools
Need to drag & drop downloaded app files into Applications
* Android Studio: download from website
* SourceTree: install from website
* Charles: install from website
* git, type git into Terminal and then follow prompt to install Xcode bundle
* install Homebrew using Terminal snippet per it's website
* `brew install git bash-completion` then add to `~/.bash_profile`:
`[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion`
* install Java8:
```
brew tap caskroom/versions
brew update
brew cask install java8
# nice ncurses Git browser
brew install tig
# the super fast silver searcher
brew install ag
```
# Config
* black terminal set in Terminal Preferences - I chose HomeBrew as default profile to start with
* adb on cli:
`echo "export PATH=\$PATH:/Users/${USER}/Library/Android/sdk/platform-tools/" >> ~/.bash_profile && source ~/.bash_profile`
# Shortcuts
* Cmd-Space: spotlight search
* Cmd-Alt-Esc: list of running apps (to choose for force kill)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment