Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save daubac402/c916fe2e44e6d11eb2c9dd22b48bbd1f to your computer and use it in GitHub Desktop.
Save daubac402/c916fe2e44e6d11eb2c9dd22b48bbd1f to your computer and use it in GitHub Desktop.
Install Teamviewer, Start, Get ClientID and password on the Remote Mac machine via SSH - commandline

Requirement

  • Homebrew on the Remote Mac (if not, just install it via SSH)

Steps

# 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!

@lenhhoxung86
Copy link

It's magical, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment