'How do I get initial admin password for jenkins on Mac?

I installed jenkins by downloading jenkins-2.2.pkg. After the installation is complete, Chrome auto-connected to http://localhost:8080/login?from=%2F and I see the following message:

Unlock Jenkins
To ensure Jenkins is securely set up by the administrator, a password has been written to the log (not sure where to find it?) and this file on the server:

/Users/Shared/Jenkins/Home/secrets/initialAdminPassword

Please copy the password from either location and paste it below.

But I don't have access to secrets folder on my Mac book even when I'm the Admin user.

Please help me on how to find the initial admin password?



Solution 1:[1]

  1. Navigate to this folder /Users/Shared/Jenkins/Home
  2. Right click on secrets/ folder and select "Get Info"
  3. Scroll down to the right bottom corner of the pop up window and click on the lock image > enter your password > ok
  4. Click on the "+" at the left bottom corner of the pop up window and add the user 4.5 Click on Settings icon - left bottom and Apply changes.
  5. Open the "secrets" folder and find the initialAdminPassword file to get the initial admin password. If you don't have permission to the file, you need to right click on the file and select "Get Info" then repeat step 3 and 4 above to access the file.

Solution 2:[2]

Try it

sudo cat /Users/Shared/Jenkins/Home/secrets/initialAdminPassword

and copy the password.

Solution 3:[3]

If you have installed Jenkins through HomeBrew, check

sudo cat /Users/$(whoami)/.jenkins/secrets/initialAdminPassword

Solution 4:[4]

I install jenkins by img, use this command to cat password

sudo cat /Users/Shared/Jenkins/Home/secrets/initialAdminPassword

Solution 5:[5]

If you have installed Jenkins using Docker and you are not able to find the password using the command :

$ sudo cat /Users/Shared/Jenkins/Home/secrets/initialAdminPassword

Then do following steps :

  1. Type in your command prompt : docker ps

  2. Find the running containerID

  3. Type docker exec -it <containerID> bash

  4. Type cd /var/jenkins_home/secrets

  5. Type cat initialAdminPassword

Solution 6:[6]

The current user might not have permissions to Secrets folder to access the initialAdminPassword file. So give permission by selecting "Secrets" folder by CMD+ i which launches a new screen and then unlock and then provide required permissions.

Locked file

Unlocked and Access to initialAdminPassword file

Solution 7:[7]

Note if you are running Homestead / Vagrant and Ubuntu

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Solution 8:[8]

If you homebrew installed JENKINS, then by default, JENKINS_HOME is at ~/.jenkins This is also the location where you will find you will find your initial password inside the secrets folder.

So: cd ~/.jenkins cd secrets open initialAdminPassword

Solution 9:[9]

ref:http://www.cimgf.com/2015/05/26/setting-up-jenkins-ci-on-a-mac-2/

  1. Make the Jenkins user an admin: sudo dseditgroup -o edit -a jenkins -t user admin

  2. Add the Jenkins user to the developer group: sudo dscl . append /Groups/_developer GroupMembership jenkins

  3. Make the Jenkins user automatically login when the computer is restarted:

Solution 10:[10]

If you are using jenkins image from dockerhub repo and create a container then you can get the initial password using:

$ sudo docker exec jenkins_containerid cat /var/lib/jenkins/secrets/initialAdminPassword

OR if installing from jenkins.io docs (https://jenkins.io/doc/book/installing/):

$ sudo docker exec jenkins_containerid cat /var/jenkins_home/secrets/initialAdminPassword

OR you can see the docker logs of container

$ sudo docker logs jenkinscontainerID

Solution 11:[11]

To unlock Jenkins, use this command in your terminal:

$ sudo cat /Users/Shared/Jenkins/Home/secrets/initialAdminPassword

Solution 12:[12]

In my case, I was looking for this on MY MAC, but what you actually have to do is ssh to your docker container.

docker ps

which will display the containers, then copy the id of the container you created,

then do

docker exec -it <paste-id-here> /bin/bash

If that's successful, you will see your terminal change to, then you can run:

cat 

Solution 13:[13]

As per Official Documentation they recommend Homebrew Installer. So if you did Homebrew Installer then check when the installation time it is printed in console or check in the current user jenkins folder.Cmd given below.

sudo cat /Users/$(whoami)/.jenkins/secrets/initialAdminPassword

Solution 14:[14]

Open your terminal and type:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword (or the path provided on the website opened).

I tried it from my Ec2 Amazon Instance and it worked!

Solution 15:[15]

For mac M1 on BigSur Os, the path I got is:

~/.jenkins/secrets 

https://www.jenkins.io/doc/book/installing/macos/

if not there look into /Users/Aakash~/.jenkins/secerts

Solution 16:[16]

1.Double tap on finder select "Go to folder" enter /Users/Shared/Jenkins/Home

2.Check the "secret" folder , right click and select "get info"

3.Click on "lock" icon and enter admin password and make change in view type (change into user view) after this your folder is accessible .

4.Do same for password text file also