Homebrew install - sudo? - bash

I am trying to install Homebrew in my terminal. It first asked me for Password which I typed in (the password I use to login to my computer) and hit enter. Then it comes up with 'Need sudo access on macOS!' - what does this mean? I am already the admin (as far as I know) as this is my personal laptop, noone else uses it.
I don't understand what else they need!
My aim is to install git but I can't even get this to install first..
Can anyone help, thanks :)

Open a new terminal session.
type sudo whoami
If it comes back with root then you have root privileges. You can also check under users and groups to see if you are an admin.
Also try running it again but using sudo first. You can also type sudo !! and that will run the previous command as sudo.

Run sudo visudo
Enter you password one last time
In the editor, search for %admin
The line probably looks like this:
%admin ALL = (ALL) ALL
Change it to this:
%admin ALL = (ALL) NOPASSWD: ALL
Save and Bob's your uncle.

If your macos account is in fact an Admin account, its password should be accepted by sudo.
See also this AskDifferent answer.

Simple solution
in the terminal type first
sudo su
Type the password
Install homebrew

So it's October 2022 and I came across the sudo messages AND I'm only running Catalina:
Go to this link: https://developer.apple.com/support/xcode/ to work out which version of Xcode is compatible with your macOS.
Sign in to your Apple Developer account and go to this page: https://developer.apple.com/download/all/. Keeping looking down the page till you come across your Xcode version but don't download Xcode just download "Command Line Tools for Xcode" with the same version number as as the compatible Xcode. These tools are a much smaller size than the Xcode file and this is really what Homebrew is looking for.
Run the downloaded installer for "Command Line Tools for Xcode".
Now run the script available on the Homebrew website: https://brew.sh, the current script is:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
This ran for me without any errors at all.
Cheers

To use a command as an admin, you need to use sudo before any command, even if you're already admin.

Related

How to uninstall Jenkins on mac completely

I installed Jenkins with brew on mac. But it occurs some problem, I want to re-install it. Previously, at the first time I access http://localhost:8080, the page guides you to install some plugins and need you to input the password. But when I use 'brew uninstall jenkins' command and install again, the page will not show. I don't remember the previous default admin passsword. So I can't access the jenkins now. I delete the homebrew cache as well, it not worked.
Is there any solutions to uninstall Jenkins completely? I just want to start from the beginning of the installation.
Thanks.
In terminal, write and execute
$/Library/Application\ Support/Jenkins/Uninstall.command
Note If you installed it with sudo, then use this:
$sudo /Library/Application\ Support/Jenkins/Uninstall.command
Then follow the instructions.
Remove the hidden .jenkins directory in your home directory that contains the configuration.
Removing the .jenkins file is actually an answer, depending how Jenkins was installed. For example, the homebrew installation does create instance-specific work area in $HOME/.jenkins
If you have the jenkins instance already running, go to $JENKINS_BASE_URL/configure and check the value of 'Home directory' - that is the place where all user-specific data is stored, like the jobs.
PS: BTW - can't get away from SO stupidity. This is a comment to the answer by Ayobi, but don't have reputation to comment.
To uninstall Jenkins service from your Mac OS X computer, execute uninstall script from terminal:
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
/Library/Application Support/Jenkins/Uninstall.command
https://wiki.jenkins.io/display/JENKINS/Thanks+for+using+OSX+Installer
I installed Jenkins as pkg from jenkins.io. There was some issue and I wanted to delete it. I couldn't find Jenkins folder or Uninstall Command in Library, so this is what I did,
Go to /Applications --> Delete the Jenkins folder
Delete /Users/Shared/Jenkins
Delete Jenkins (there will be a standard user with no name username for the first time when jenkins is installed) from "Users & Groups"
After this I re-installed Jenkins and it seem to work.
Try:
brew uninstall jenkins-lts
rm -r /Users/admin/.jenkins

Troubles with installation of Homebrew

I am trying to install Homebrew on a fresh install of OS X Yosemite (removed old partition using disk utility and did a complete re-install, carried over no media, completed about 10 minutes ago).
Unfortunately I have closed terminal since the first time I attempted the install using:
"ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)",
as such I do not have the original error code. I used the install command as provided above, and was directed to install command line tools. This part played out fine. After command line tools installed I hit 'return' as directed, and it began 'installing home-brew'. The installation seemed to stall and then an error message was displayed.
So then I re-attempted the install by simply re running the same terminal prompt and terminal gave me this message:
"Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.",
then this it said that the installation was successful. However, I was then prompted to run brew doctor, to which I then ran and subsequently was alerted with:
"Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool".
I then used the prompt "brew help" to see if it would work and it did, but again trying to use brew doctor yielded: "Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool".
I then attempted to use the lines from https://gist.github.com/mxcl/1173223 to uninstall Homebrew. Terminal displayed a message of success. I then quit terminal, re-opened it and typed brew to which I was given a catalogue of options to which I assumed brew was not installed as I had thought.
So, I do not know what went wrong with my installation of Homebrew and if someone could educate me that would help. I would also appreciate information of how to go about uninstalling and then reinstalling Homebrew with success.
Thanks
I just came across same problem (using Yosemite), with same error message. I'm a newbie on this, so I might be doing, but what I tried seemed to be working. I think this is not an installation error, but we just have to agree the license and run via sudo.
Here are the step I took. (It's a bit redundant)
First I did "sudo brew doctor"
Then it said:
You have not agreed to the Xcode license agreements, please run
'xcodebuild -license' (for user-level acceptance) or 'sudo xcodebuild
-license' (for system-wide acceptance) from within a Terminal window to review and agree to the Xcode license agreements.
Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool
So I did "xcodebuild -license"
Then it said:
Agreeing to the Xcode/iOS license requires admin privileges, please
re-run as root via sudo.
So I did "sudo xcodebuild -license"
Then it said:
You have not agreed to the Xcode license agreements. You must agree to
both license agreements below in order to use Xcode. Hit the Enter key
to view the license agreements at
'/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'
And then I hit enter and the MAC SDK AND XCODE AGREEMENT.
You have to read to the end to actually agree to this. So I kept hitting space to show the entire Agreenent.
At the end, it said
By typing 'agree' you are agreeing to the terms of the software
license agreements. Type 'print' to print them or anything else to
cancel, [agree, print, cancel]
Then I typed "agree" and "brew doctor," it said
Your system is ready to brew.
I hope this helps!
open you xcode tools ,and it will pop up a window to let you agree xcode license and back to term window ,it will work

Mac: How to fix sudo command failure?

I am writing script to run SU commands programmatically to do various operations. But, All the commands created through my program is not working. Then, i tried those commands in Terminal (Mac os x) by typing it, but it gives the following result,
sudo: apt-get: command not found
Could someone please advise me, why is this error coming up, how can i make these working?
Homebrew installs the stuff you need that Apple didn’t.
install ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
e.g :
$ brew install wget
There's also MacPorts, and fink -- I also have homebrew, but also keep the others around for when I encounter things that one system has that the other doesn't.
apt-get is unique to the Debian based operating systems. If you want a package manager for OSX, may I suggest homebrew
http://brew.sh

Xcode is not currently available from the Software Update server

I have problems with my macport after update to OS X 10.9.
I try to follow this manual https://trac.macports.org/wiki/Migration to fix them.
But when I install Command Line Tools:
xcode-select --install
I get message
Can't install the software because it is not currently available from
the Software Update server.
Meanwhile I successfully updated my other machine to OS X 10.9. and installed command-line tools with no problems, so they must be available.
What is the problem here?
You can download the command line tools for OS X Mavericks manually from here:
https://developer.apple.com/downloads/index.action?name=for%20Xcode
For OSX 10.11 or more you can download from here https://developer.apple.com/download/more/.
(The link in the accepted answer doesn't display command line tools for El Capitan (OSX 10.11))
If you are trying this on a latest Mac OS X Mavericks, command line tools come with the Xcode 5.x
So make sure you have installed & updated Xcode to latest
after which make sure Xcode command line tools is pointed correctly using this command
xcode-select -p
Which might show some path like
/Applications/Xcode.app/Contents/Developer
Change the path to correct path using the switch command:
sudo xcode-select --switch /Library/Developer/CommandLineTools/
this should help you set it to correct path, after which you can use the same above command -p to check if it is set correctly
I faced same problem of Can't install the software because it is currently not available from the Software Update Server. You may try following steps instead to make the Software Update initiate update for the Command Line Tools.
Check if Command Line Tools Update is mentioned in your list of softwares to be updated by using following command: softwareupdate -l
If Command Line Tools Update is not mentioned in that list, then manually make it part of the list using following command which will create a temporary file: sudo touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
Verify that the list now has the Command Line Tools mentioned by running softwareupdate -l again.
Now, press Cmd+Space to initiate Mac's Spotlight Search. Search for Software Update. Start the Software Update.
That will show you following kind of dialog for installing the Command Line Tools. Install away the update and be merry. :)
Remove the temporary file created in Step 2: sudo rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress.
I deleted the command tools directory given by xcode-select -p due to npm gyp error.
xcode-select failed to install the files with the not available error.
I ran the Xcode application and the command tools installed as part of the startup.
npm worked.
However this didn't fully fix the tools. I had to use xcode-select to switch the path to the Developer directory within the Xcode application directory.
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
MacOS catalina.
I just got the same error after I upgraded to 10.14 Mojave and had to reinstall command line tools (I don't use the full Xcode IDE and wanted command line tools a la carte).
My xcode-select -p path was right, per Basav's answer, so that wasn't the issue.
I also ran sudo softwareupdate --clear-catalog per Lambda W's answer and that reset to Apple Production, but did not make a difference.
What worked was User 92's answer to visit https://developer.apple.com/download/more/.
From there I was able to download a .dmg file that had a GUI installer wizard for command line tools :)
I installed that, then I restarted terminal and everything was back to normal.
I know this is an old post but I also ran into this problem today. I found out that when I executed sudo softwareupdate -l the Command Line Tools were listed as an update, so I installed them using sudo softwareupdate -i -a.
This error can occur if you are using a software update server which doesn't host the required package.
You can check this by running
defaults read /Library/Preferences/com.apple.SoftwareUpdate
and seeing if you have an entry called CatalogURL or AppleCatalogURL
You can point back at the Apple software update server by either removing this entry or using the command
sudo softwareupdate --clear-catalog
And then run the command line tools install again.
I got the same issue on MacOS Catalina.
I think I identified the root cause: I have switched the default Apple ID account and the new one was not activated as a Developer account. When I ran the xcode-select --install command, I got the same error as stated in the issue description.
After reading this post on stackoverflow, I went on https://developer.apple.com/downloads and I was asked to accept Developers terms. I think it enabled my account as a developer one. Then, I tried to run xcode-select --install again and it worked.
The command
xcode-select --install
proposes 3 options: Get Xcode; Not Now; Install.
When I choose to get full Xcode the command finished successfully. It took a while, but this way I was able to complete all macports migration instructions.
Once you get the command line tools loaded as described by Nikos M in his excellent answer above you will need to agree to the gcc license and if you are using ruby gems you may need to link llvm-gcc as gcc-4.2.
If you do not do these the gem install will report "You have to install development tools first." after you have already installed them.
The steps are:
sudo gcc
sudo ln -s /usr/bin/llvm-gcc /usr/bin/gcc-4.2
The gcc must be run once under sudo so Apple can update their license info, you don't need an input file, it will update the license before it checks its arguments. The link is needed so that ruby 1.9 can find the compiler when building certain gems, such as the debugger. This may be fixed in ruby 2.x, but I'll cross that bridge when I get there.
I had to run Xcode.app and agree to the License Agreement
Setup: Brand new MacBook with Mavericks, then brew install and other c/l type things 'just work'.
I solved this by going to the App Store and installing Xcode.
It was a pretty large 11GB install, so this is probably overkill. But, as a last resort, it seems to have solve my issues. In the middle of the installation (well around 10GB), Mac OS told me there was an update to Command Line Tools for Xcode. Performing this installation won't fix anything until Xcode is fully installed.
Once the install is done, it should start working (after you accept the license agreement).
Command + Space
Search for Xcode
Open it and accept license
Then run again from terminal xcode-select --install
Had the same issue and was getting the same error. When i ran xcode-select -p, it gave output as /Library/Developer/CommandLineTools. So that means xcode was already installed in my system. Then i ran steps as given on this answer. After which any command which required xcode ran successfully.

Is it possible to use firefox's google search bar directly from command line?

I checked through firefox's supposedly supported command line arguments and found this distinctly lacking, but I can't help but assume it must be somehow possible. Any thoughts on how? Currently running Ubuntu 11.10 if that changes anything.
If you're talking about the Developer Toolbar, it doesn't look like that has access to the built-in search. It's mainly for quick access to developer tasks (type help to see the full range of what it accesses), not for driving regular browsing tasks.
install googler using terminal in ubuntu
Step-1 : Install git(if not installed)
sudo apt-get install git
Step-2: Change the directory
cd /tmp
Step-3: Clone it from link given below using command
git clone https://github.com/jarun/googler.git
Step-4: get into googler directory
cd googler
Step-5:
sudo make install
Step-6:After that move to bash directory
cd auto-completion/bash/
Step-7:Finally copy file into etc/bash_completion.d
sudo cp googler-completion.bash /etc/bash_completion.d/
Now from terminal open googler
googler your_query
For further query refer here
use man googler for more option

Resources