After upgrading to macOS High Sierra (10.13), I noticed some of my Transmit bookmarks to connect to SFTP servers via SSH were no longer working. By using the command line to try to connect I received an error message along the lines of:

Unable to negotiate with [IP_ADDR] port 22: no matching cipher found. Their offer: twofish256-cbc,twofish-cbc,twofish128-cbc,blowfish-cbc,3des-cbc,arcfour,cast128-cbc,aes256-cbc,aes128-cbc

Turns out the release of macOS disabled support for old ciphers (likely for security reasons. Since I don’t administer the servers I was needing to connect to, I had little choice but to re-enable support for older Ciphers. I did this by editing /etc/ssh/ssh_config adding the following line:

Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc

Instructions derived from https://support.apple.com/en-us/HT201372

We’ll be using terminal and the createinstallmedia command:

Download the macOS Sierra installer

Launch the App Store app, then look for macOS Sierra in the store. (Here’s a link.) Click on the Download button, and your Mac will download the installer to your Applications folder. If it automatically launches after download, quit the installer.

 

Download the macOS installer from the Mac App Store. Quit the installer if it opens automatically after downloading. The installer will be in your Applications folder.
Mount your USB flash drive or other volume. You could also use a secondary internal partition.
Open the Terminal app, which is in the Utilities folder of your Applications folder.
Use the createinstallmedia command in Terminal to create the bootable installer. For detailed usage instructions, make sure that the appropriate macOS installer is in your Applications folder, then enter one of the following paths in Terminal:
Path for Sierra:
/Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia
Path for El Capitan:
/Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia
Path for Yosemite:
/Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia
Path for Mavericks:
/Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia
Examples

This is the basic syntax of the command. Replace volumepath with the path to your USB flash drive or other volume, and replace installerpath with the path to the Install OS X app.
createinstallmedia –volume volumepath –applicationpath installerpath
The following examples assume that the OS X installer is in your Applications folder and the name of your USB flash drive or other volume is MyVolume:
Example for Sierra:
sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia –volume /Volumes/MyVolume –applicationpath /Applications/Install\ macOS\ Sierra.app
Example for El Capitan:
sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia –volume /Volumes/MyVolume –applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app
Example for Yosemite:
sudo /Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia –volume /Volumes/MyVolume –applicationpath /Applications/Install\ OS\ X\ Yosemite.app
Example for Mavericks:
sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia –volum

I had an issue with an Apple MacBook Pro that was constantly running the fans at high RPM’s. Sometimes the CPU was running high (90-100%) without justification (simply browsing the web and checking email) other times the CPU was running low (10-15%). Steps to resolve included:

  1. Reset the NVRAM (non-volatile random access memory)
  2. Reset the SMC (system management controller)

How to reset NVRAM on your Mac¹

Follow these steps to reset your Mac computer’s NVRAM.

If you have a late-2016 MacBook Pro, the steps are slightly different. Skip to the next section for instructions.

  1. Shut down your Mac.
  2. Find Command (⌘), Option, P, and R on your keyboard.
  3. Turn on your Mac.
  4. Press and hold the Command-Option-P-R keys immediately after you hear the startup sound.
  5. Hold these keys until the computer restarts and you hear the startup sound for a second time.
  6. Release the keys.

After resetting NVRAM, you might need to re-configure settings for speaker volume, screen resolution, startup disk selection, and time zone information.

If issues related to these features continue on a desktop Mac (like an iMac, Mac mini or Mac Pro), its logic board battery might need to be replaced. The logic board battery on desktop computers helps retain NVRAM settings when your Mac is unplugged. You can take your Mac to an Apple Store or Apple Authorized Service Provider to replace the battery on the logic board.

Reset the System Management Controller (SMC) on your Mac²

Before resetting the SMC

Reset the SMC only after you’ve tried all other standard troubleshooting. Try each of the following steps in this order before you reset the SMC. Test the issue after completing each troubleshooting step to see if the issue still occurs.

  1. Press Command-Option-Escape to force quit any application that is not responding.
  2. Put your Mac to sleep by choosing Sleep from the Apple menu. Wake the computer after it has gone to sleep.
  3. Restart your Mac by choosing Restart from the Apple menu.
  4. Shut down your Mac by choosing Shut Down from the Apple menu.
  5. If your Mac isn’t responding, force the Mac to shut down by pressing and holding the power button for 10 seconds. You’ll lose any unsaved work in any open applications.

If you’re using a Mac notebook computer that is having issues related to power or the battery:

  1. Unplug the power adapter from your Mac and the electrical outlet for several seconds, then plug it back in.
  2. Shut down your Mac. 
  3. Remove and re-insert the battery, if it’s removable battery.
  4. Restart your Mac.

If the issue still isn’t resolved, you might need to reset the SMC. See the indicators and steps below. 

Indicators that your SMC might need to be reset

After you perform normal troubleshooting, these symptoms may indicate that an SMC reset could be necessary:

  • The computer fans run at high speed, though the computer is not experiencing heavy usage and is properly ventilated.
  • The keyboard backlight behaves incorrectly on Mac computers that have this feature.
  • The status indicator light (SIL) behaves incorrectly on Mac computers that have this feature.
  • Battery indicator lights, if present, behave incorrectly on Mac notebooks that have a non-removable battery.
  • The display backlight doesn’t respond correctly to ambient light changes on Mac computers that have this feature.
  • The computer doesn’t respond to the power button when pressed.
  • A Mac notebook computer doesn’t respond properly when you close or open the lid.
  • The computer sleeps or shuts down unexpectedly.
  • The battery doesn’t charge properly.
  • The MagSafe power adapter LED doesn’t indicate the correct activity.
  • The computer is performing unusually slowly, though it isn’t experiencing abnormally high CPU utilization.
  • Application icons may bounce in the Dock for an extended amount of time when opened.
  • Applications may not function correctly, or they may stop responding after being opened.
  • A computer that supports target display mode does not switch into or out of target display mode as expected, or it switches into or out of target display mode at unexpected times.
  • The illumination around the I/O ports on a Mac Pro (Late 2013) does not activate when you move the computer.

Reset the SMC on Mac notebook computers

First determine whether the battery is removable. Mac notebook computers that have a non-removable battery include MacBook Pro (Early 2009) and later, all models of MacBook Air, MacBook (Late 2009), and MacBook (Retina, 12-inch, Early 2015). Learn more about Mac notebook batteries.

If the battery is non-removable 

  1. Shut down the Mac.
  2. Plug in the MagSafe or USB-C power adapter to a power source and to your Mac.
  3. Using the built-in keyboard, press Shift-Control-Option on the left side of the keyboard, then press the power button at the same time.
  4. Release all keys, then press the power button again to turn on your Mac

If the battery is removable

  1. Shut down the Mac.
  2. Disconnect the MagSafe power adapter from the Mac.
  3. Remove the battery. (Learn about removing the battery in MacBook and MacBook Pro computers.)
  4. Press and hold the power button for 5 seconds.
  5. Reconnect the battery and MagSafe power adapter.
  6. Press the power button to turn on the Mac.

The LED on MagSafe power adapters might change states or temporarily turn off when you reset the SMC.

Reset the SMC on Mac desktop computers

Follow these steps for iMac, Mac mini, Mac Pro, and Xserve.

  1. Shut down the Mac.
  2. Unplug the power cord.
  3. Wait 15 seconds.
  4. Plug the power cord back in.
  5. Wait 5 seconds, then press the power button to turn on the Mac.

For Intel-based Xserve computers that aren’t responding, you can shut down locally or by using remote commands. You can also shut down by pressing and holding the power button for 5 seconds.

Learn more

Resetting the SMC does not reset or otherwise change the contents of NVRAM or PRAM on Intel-based Macs.

The SMC is responsible for these and other low-level functions on Intel-based Macs:

  • Responding to presses of the power button
  • Responding to the display lid opening and closing on portable Macs
  • Battery management
  • Thermal management
  • The SMS (Sudden Motion Sensor)
  • Ambient light sensing
  • Keyboard backlighting
  • Status indicator light (SIL) management
  • Battery status indicator lights
  • Selecting an external (instead of internal) video source for some iMac displays

If neither of these steps fix the fan issue, you might have a more serious hardware related issue.

References:

¹ https://support.apple.com/en-us/HT204063

² https://support.apple.com/en-us/HT201295

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval “$(dircolors -b ~/.dircolors)” || eval “$(dircolors -b)”
alias ls=’ls –color=auto’
alias grep=’grep –color=auto’
alias fgrep=’fgrep –color=auto’
alias egrep=’egrep –color=auto’
fi

alias l=’ls -CF’
alias ll=’ls -alhF’
alias la=’ls -A’
alias cp=’cp -iR’
alias df=’df -h’
alias v=’vim’
alias md=’mkdir’
alias rd=’rmdir’

# Add an “alert” alias for long running commands. Use like so: sleep 10; alert
alias alert=’notify-send –urgency=low -i “$([ $? = 0 ] && echo terminal || echo error)” “$(history|tail -n1|sed -e ‘\”s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//’\”)”‘

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=5000
HISTFILESIZE=9000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
	# We have color support; assume it's compliant with Ecma-48
	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
	# a case would tend to support setf rather than setaf.)
	color_prompt=yes
    else
	color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

An alias is simply a reference to a string, but it makes it possible to shorten a command (or set of commands) inclusive of any options for the command.

Why use aliases?

To save time. Programmers like to refer to themselves as a lazy bunch, but I prefer to think in terms of being efficient rather than lazy. By creating an alias you can save time on the command line. For instance, to view a list of the contents of a directory I like to use “ls -alhF” to generate a nice human readable list. I do this a lot when working from the command line, so it’s much easier to have a alias for this.

Creating aliases

Use the alias command to create your own aliases using the following general syntax: alias [-p] [name=”value”]. For example, to create an alias named ll that executes the command+options ls -alhF, you would execute the following:

alias ll="ls -alhF"

Using aliases

Using the ll alias created in the example above is as simple as typing:

ll

Removing Aliases

Use the general syntax: unalias [-a] name(s). For Example, to remove the alias named ll execute the following:

unalias ll

My favorite aliases

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

alias l="ls -CF"
alias ll="ls -alhF"
alias la="ls -A"
alias cp="cp -iR"
alias df="df -h"
alias v="vim"
alias md="mkdir"
alias rd="rmdir"

# Add an "alert" alias for long running commands.  Use like so: sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

Making aliases permanent (survive sessions and reboot)

edit the file /etc/bashrc for system wide aliases 
edit the file ~/.bashrc for user specific aliases

For macOS
create the file ~/.bash_profile and add this:
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

Every now and then SmartGit complains about my version of git on Mac OS X. It says I don’t have a recent enough version of the git executable. I have SmartGit configured to use the git executable found in /usr/bin/git on my Mac. Now, I know that the version meets the minimum requirements, so what’s the problem.

This often occurs after an update to Xcode and the problem is related to Apple wanting me to agree to the licensing terms (yet again). I have to manually execute git in order to view and agree to the new license terms.

To do so and fix the problem run:

sudo /usr/bin/git --version

…then follow the prompts to agree to the new Xcode license terms. Problem solved.

Assuming:

  • “Install OS X Yosemite.app” is located in the “Applications” folder
  • USB stick has been erased/formatted and labelled UNTITLED
  • USB stick is 8GB or larger

Run the following:

sudo /Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia --volume /Volumes/UNTITLED/ --applicationpath /Applications/Install\ OS\ X\ Yosemite.app --nointeraction

process steps:

  1. export the database
  2. updated the static entries of the hostname in the database
  3. import the database

commands:

  1. mysqldump -u _USERNAME_ -p _DBNAME_ > _DBNAME_.sql
  2. cat _DBNAME_.sql | sed -e ‘s/_HOSTNAME_/_NEWHOSTNAME/g’ > _DBNAME_UPDATED.sql
  3. mysql -u _USERNAME_ -p _DBNAME_ < _DBNAME_UPDATED.sql

options & variables:

  • _USERNAME_ = the the database user name
  • -p = will prompt for the password
  • _DBNAME_ = the name of the database
  • _HOSTNAME_ = the hostname of the existing server
  • _NEWHOSTNAME = the new hostname to use
  • _DBNAME_UPDATED = the name of the new updated SQL file

If you want to update git submodules, you will need to do this directly in your submodules directory

# download the submodule
git submodule add https://user@repourl/reponame.git submodule_dir/

# initialize the submodule
git submodule init
# update your submodule
cd submodule_dir/
git checkout master 
# or git checkout mybranch
git pull

# commit the submodule update from root directory
cd ../
git commit -am "update submodule_dir to commit Abc123"

Or if you like shortcuts:

git submodule foreach git pull origin master