- Homebrew on the Remote Mac (if not, just install it via SSH)
# ssh to the remote Mac machine, then:
brew install caskroom/cask/brew-cask
brew cask install teamviewer
sudo /Applications/TeamViewer.app/Contents/MacOS/TeamViewer
If the error is: _RegisterApplication(), FAILED TO establish the default connection to the WindowServer. OK, stop here. You can't.
If the error is: com.teamviewer.desktop: Invalid argument com.teamviewer.teamviewer: Invalid argument OK, run again but without sudo
/Applications/TeamViewer.app/Contents/MacOS/TeamViewer
If you just want to get ClientID:
export DISPLAY=:0
# defaults read /Library/Preferences/com.teamviewer.team...(or something) ClientID
# for me is: defaults read /Library/Preferences/com.teamviewer.teamviewer.preferences.plist ClientID
# You can get only ClientID.
Or want to get all ClientID and password:
osascript -e 'tell application "TeamViewer" to activate'
# screencapture teamviewer.jpg
# Download this image to your computer (Eg: via SCP)
Enjoy!
It's magical, thanks.