Skip to content

Instantly share code, notes, and snippets.

@ej3
Last active January 29, 2021 04:06
Show Gist options
  • Save ej3/10c44191f24c864d345d to your computer and use it in GitHub Desktop.
Save ej3/10c44191f24c864d345d to your computer and use it in GitHub Desktop.
run nexus from brew on osx
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.sonatype.nexus</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/opt/nexus/bin/nexus</string>
<string>start</string>
</array>
<key>UserName</key>
<string>[newuser]</string>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
#get app
sudo brew install nexus
#setup [newuser] using GUI (can be done in shell, but absurd)
#something like (see: http://jamesmead.org/blog/2011-01-20-adding-a-user-in-osx-on-command-line)
sudo dscl . -create /Users/newuser
sudo dscl . -create /Users/newuser UserShell /bin/bash
sudo dscl . -create /Users/newuser RealName "New User"
sudo dscl . -create /Users/newuser UniqueID "####"
sudo dscl . -create /Users/newuser PrimaryGroupID ####
#change owner of Cellar
sudo chown -R [newuser] /usr/local/Cellar/nexus
#change permissions on plist
sudo chown root:wheel /usr/local/Cellar/nexus/<ver>/homebrew.mxcl.nexus.plist
sudo chmod 644 /usr/local/Cellar/nexus/<ver>/homebrew.mxcl.nexus.plist
#add user specification to plist
#(see attached com.sonatype.nexus.plist)
#link to plist from launchctl
ln -sv /usr/local/opt/nexus/homebrew.mxcl.nexus.plist /Library/LaunchDaemons/com.sonatype.nexus.plist
#if exists change ownership of /var dir
sudo chown -R [newuser] /usr/local/var/nexus
#create var dir if not exist
sudo mkdir -p /usr/local/var/nexus
sudo chown nexus /usr/local/var/nexus
#load the service
sudo launchctl load /Library/LaunchDaemons/com.sonatype.nexus.plist
##server should be available (check localhost:8081/nexus)
#if web fail: check log at
/usr/local/Cellar/nexus/<ver>/libexec/wrapper.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment