'Jenkins' user is not created on OS X install - xcode

When reading about Jenkins installation, many guides talk about that the installer created a user called 'Jenkins' on OS X. This user seems to be important for certain tasks.
However, installing Jenkins 2.32 using homebrew does not install this user here. Why is that - am I missing something?
Background: I want to run CI for iOS together with a Gitlab server.

Jenkins installed via Homebrew is kind of a mess - and I say this because it isn't terribly obvious in the log output where/who gets permissions.
Jenkins DOES NOT create a jenkins user on Mac OS (nor should it ever, imo).
By default, the user that was actively using brew install jenkins is the one who will get the default permissions. There should be a /.jenkins folder within that users home folder (ex: /Users/<your_user>/.jenkins)
The problem is that when brew finishes running, some files that should get symlinked to the active user don't - so you might create a job using rvm/ruby for example, and get errors that bundler can't write to the system ruby.
Try this in terminal/iTerm:
sudo chown whoami /Library/LaunchDaemons/homebrew.mxcl.jenkins.plist
also whoami should be surrounded by ticks `
I tend to just do these commands after a brew install jenkins
ln -sfv /usr/local/opt/jenkins/*.plist ~/Library/LaunchAgents
Symlink the Jenkins plist files to /Library/LaunchAgents
sudo cp -fv /usr/local/opt/jenkins/*.plist /Library/LaunchDaemons
Copy plist files to /Library/LaunchDaemons
sudo chownwhoami/Library/LaunchDaemons/homebrew.mxcl.jenkins.plist
Give sudo ownership of the plist file listed to the user outright
This part isn't necessary...
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
Here's something to refer to:
http://flummox-engineering.blogspot.com/2016/01/installing-jenkins-os-x-homebrew.html

Related

Fix Home Brew permissions on High Sierra

I accidently tried renamed my home folder on my mac. Never. Ever. Do. That! Homebrew no longer works... I get this error no matter what I try to install (or another github address).
Error: Permission denied # rb_sysopen - /private/tmp/github_api_headers20180921-5820-13099yc.
Nothing works, not even wget or mysql.
I tried uninstalling / re-installing but doesn't work.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
How can I fix homebrew? Is it necessary to wipe the whole computer?
Files under /Users/myuser should have ownership to myuser and group ownership to staff.
I don't know your specific settings but before to wipe out your system you could try to restore these basic ownerships with:
chown -R myuser:staff /Users/myuser
where myuser is the name of your user. As I said, I don't know anything about your specific settings so do this at your own risk.

Run gcloud without sudo

I'm on Mac OSX and I've always had to run the gcloud command with sudo. I can usually work around it, but it has started to cause me some issues. I tried following this answer here, but I am not sure where the gcloud command gets called from. It's not in /usr/bin.
I have found that my gcloud sdk is installed at /Users/Max/Desktop/google-cloud-sdk/, and I have tried adding /bin/gcloud and '/lib/gcloud.py' from that path. No luck! Any idea how I can give NOPASSWD permissions to this command?
I'm on macOS and my issue was that my google-cloud-sdk install folder and it's config folder at ~/.config/gcloud were owned by root. The fix is to sudo chown -R <your-username> google-cloud-skd and sudo chown -R <your-username> ~/.config/gcloud. And done: no more sudo.
I was able to resolve this issue myself. This article was very helpful. Ultimately, you just have to add sudo privileges to the gcloud command. You will have to give those permissions by running sudo visudo and adding a line in the following format:
<yourusername> ALL=NOPASSWD: <command1>, <command2>
Mine line ended up looking like this:
Max ALL=NOPASSWD: /Users/Max/Desktop/google-cloud-sdk/bin/gcloud
The part that tripped me up was figuring out where the gcloud command was installed. You have to add that path at the end of the permissions. You can find out where it is installed by running which gcloud.

Meteor requires sudo to run

Previously I was able to start Meteor 0.6.6.3 by simply running mrt.
Recently, Meteor 0.7.0.1 wont run properly unless I run it as root with sudo mrt. Environmental variables like MONGO_URL requires root to set it.
Any ideas what happened? I'm using Mountain Lion on Mac OSX.
You might have run it with sudo once before. When you run it with sudo just once and a file is written the files become root files root user file so it needs more permissions to run and wont run
ordinarily.
You might have run sudo mrt once it must have updated files for a package but they're now owned by root instead of your normal user.
I'm sure theres a terminal command to get it back but using Disk Utility and running 'Repair Disk Permissions' can also fix it (i think).

PostgreSQL permissions issue after upgrading to OS X Lion

After upgrading to Lion, I get the following error when trying to start up the Postgres server:
pg_ctl: could not open PID file "/usr/local/var/postgres/postmaster.pid": Permission denied
I also tried to re-run the initdb command, but ran into a similar problem:
initdb: could not access directory "/usr/local/var/postgres": Permission denied
If it matters, PostgreSQL was installed via Homebrew. Running brew info postgresql yields the expected results (version, summarized docs).
Well, it turns out the solution was pretty simple. I changed the group on /usr/local/var to staff (from wheel) and changed the ownership (chown -R) to my system account (from root).
After that, postgres started up fine.
I was a little nervous changing those permissions, but the only thing in my /usr/local/var was a postgres directory, so all should be well. If you have other directories/files in /usr/local/var, maybe don't use the -R flag when chown'ing?
The Homebrew ruby installer script changes the group of /usr/local/var to staff, so that must have gotten undone when upgrading to Lion. Not sure about the ownership being root instead of my system account though...
sudo chown -R $(whoami) /usr/local/var

Cocoa Launch agent registering itself after installation

I have created Cocoa app which is type of launch agent. To distribute this I have created package as well which installs the app and copies the launchagnet plist file in /Libraries/LaunchAgents.
Now the problem is after installation i want this app to be running in user context immediately without logoff/restart. If I register this with "launchctl" from installer, using post install script, it run in root context, as installer is running in root context.
Any suggestion how the agent registers itself to launchctl and runs in user context.
Try this in the postinstall script:
/usr/bin/sudo -u $USER /bin/launchctl load -S Aqua /Library/LaunchAgents/com.yourcompany.launchagent.plist
Note that if multiple users are logged in via Fast User Switching, this will only activate your launch agent for the user who installed it.
There is an unsupported way to make this work with multiple users logged in on Mac OS X 10.5/10.6, using launchctl bsexec; see this mailing list post for more information.

Resources