Why is my xcode-select uninstall not working? - uninstallation

I am trying to uninstall xcode-select by removing its directory and all contents with;
sudo rm -rf /Library/Developer/CommandLineTools
However when after running the above command, I then run:
xcode-select -p
to verify that it's gone it reports back with the same original location;
/Library/Developer/CommandLineTools
I navigate via command line to the Developer folder and the CommandLineTools directory is no longer present. Also, when i run:
xcode-select --version
it still reports back with xcode-select version 2396.
Are these perhaps just variables that need resetting after I've already deleted xcode-select, and or what other steps ought I to take to fully delete xcode-select and it's settings/associations from my system?

I am not really sure what you are trying to achieve, but the executable for the xcode-select is located in the /usr/bin.
If you are trying to remove the command line tools you need to delete /Library/Developer/CommandLineTools. If it is still there after you try to remove it you are doing something wrong.
If you installed the command line tools bundled with Xcode you need to completely remove Xcode first.

You should use:
sudo xcode-select -r
You should read the help message.
xcode-select -h
You will find the option -r:
-r, --reset reset to the default command line tools path
MacOS seems to remember the path even after you have uninstalled CLT. You need to reset it if you want.

Yes, the system remembers the previous settings. This is necessary or you would have to redefine all the time after every restart, login, and new shell your development environment. xcode-select -p or xcode-select -print-path are the recommended techniques to learn about the current settings.
On newer macOS the needed information is stored at /var/db/xcode_select_link. The latter file is a symbolic link to the wanted development environment, e.g. /Library/Developer/CommandLineTools or /Applications/Xcode.app/Content/Developer. xcode-select -p does basically simply a readlink /var/db/xcode_select_link.
Note, this xcode_select_link influences your terminal commands in a convenient manner. Despite your $PATH may give /usr/bin a higher priority, a command line starting with gcc will not call /usr/bin/gcc but one preceded by a possibly very long path pointing deep into your Xcode.app package. Check it out, e.g. with which gcc while having an Xcode in use (e.g. after having executed sudo xcode-select -switch /Applications/Xcode.app and opened a new shell).

Related

Build tools broken after uninstalling Xcode

When I use make to build my C++ project from the command line (cmake .., make) after installing and uninstalling xcode, make outputs make[2]: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++: No such file or directory
xcode-select -p output:
/Library/Developer/CommandLineTools
sudo xcode-select --install output:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
xcode-select --reset output: nothing
I uninstalled and reinstalled the xcode command line tools and it still gives the same No such file or directory error
CMake stores the results of its system introspection - the full path to the compiler used is one of them - in a file called CMakeCache.txt.
If you change something in your system that invalidates these results you need to clear the cache, i.e. delete the CMakeCache.txt file in the build folder.

Compilation issue with C++ on CLION [duplicate]

I'm having xcode issues when I try to use brew and git:
xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist, use xcode-select --switch path/to/Xcode.app to specify the Xcode that you wish to use for command line developer tools (or see man xcode-select)
I can type xcode-select and it shows that the command exists. When I type xcode-select -p it shows:
/Applications/Xcode.app/Contents/Developer
but when I do which xcode-select, it gives me:
/usr/bin/xcode-select
I've tried to use the command switch and install again via Apple Developer site but none of these options have work so far... How can I fix this?
I tried that and it didn't work but I found the answer. I just had to reset the developer's path:
$ sudo xcode-select --reset
Now everything is normal
Mostly this error occurs when you have installed a newer version of xcode. And the command line tools are yet to be initialized.
To resolve this:
Go under Xcode Preferences > Locations (tab) > And the bottom options is Command Line Tools. Please select the Xcode version for tools.
Example (For Xcode 10.0 (10A255) ):
Go under Xcode Preferences > Locations (tab) > And the bottom options is Command Line Tools. Select Xcode 10.0 (10A255).
For more details please see this image:
In my case, I had uninstalled Xcode and then issues with git cli started. I solved the problem running the following commands:
$ sudo xcode-select -r
$ sudo xcode-select --switch /Library/Developer/CommandLineTools
and then validating new path with:
$ sudo xcode-select -p
I have faced the same issue as I have uninstalled the XCode abruptly, running the below command (from Terminal) helped me to resolve this.
sudo xcode-select -switch /
This error coming because xcode get deleted, corrupt or moved.
In my case i removed xcode from my Mac and faced the same issue.
I fixed it by simple two steps
Open Terminal
Simply run following command
sudo xcode-select -r
And now error has resolved. Hope it will helpful.
Use this:
sudo xcode-select -switch /
This should solve the problem.
How about what the error suggests? Did you try that?
xcode-select --switch /Applications/Xcode.app
That should do the trick.
For me it helps to install Xcode CLI
xcode-select --install
after uninstalling XCode (I don't develop for the OSx or iOS)
Then I could successfully build downloaded source with make
Try error suggestion :
sudo xcode-select --switch /Applications/Xcode.app
And Then test Git Executable Path.
I had the same problem and had to remove completely Developer tools, and reinstall:
$ rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
Tip: because Xcode had been improperly uninstalled, I had to manually (re)move the Xcode app, too:
$ mv /Applications/Xcode.app/ /Applications/Xcode.app.bak
In my case such error occurred after I has tried to symbolicate crash report, and according to a manual, entered command export DEVELOPER_DIR=”/Applications/Xcode.app/Contents/Developer”
I tried some proposed here solutions but nothing helped.
Then I realized that I have added an environment variable DEVELOPER_DIR to my terminal and this led to error: "xcrun: error: missing DEVELOPER_DIR path:"
Then I've just reboot my terminal, that cleaned the environment variable and the error disappeared.
(FYI: environment variables may be checked with printenv command in terminal)
for my mbp m1 apple sillicon for the case alr tried all the above answer and not solved.
i have solved by here discussion https://developer.apple.com/forums/thread/660641
there is have 2 option to solve, my case...
i have uninstalled xcode because i don't need again
install standalone mode, doesnt work. can't install the software
solved by try download manual command line tools check on the discussion thread for the link file ( 741.5 MB ) .

no member named 'isinf' in the global namespace

I'm having problems compiling pretty much anything on my Mac (including for example xgboost), suggesting that the problem isn't with individual projects but with something that's wrong on my machine. Others in my team can compile things fine.
When I try and compile, I get errors like:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:317:9: error: no member named 'isinf' in the global namespace
using ::isinf;
all are problems in cmath.
I have:
Checked that cmake is up to date.
Completely removed and reinstalled Command Line Tools using xcode-select --install
Completely remove XCode and run sudo xcode-select --reset
Compared my make configure output with a coworker - it is identical, as are all versions of all tools/libraries
Checked for anything in brew that looks problematic - can't see anything. Brew doctor says I'm ready to brew (everything is fine).
Check my MacOS SDK is ok, it is (10.15)
Any issues on GitHub or here that I've found don't have an answer that points to the root cause of the issue.
What is going on here? At the very least, where can I look for more clues?
You may try to use the CommandLineTools SDK rather than the XCode.app SDK. Running "xcode-select --reset" will make the macOS fallback to use the XCode.app SDK.
#Check the current sdk
xcrun --show-sdk-path
#Change sdk
sudo xcode-select -s /Library/Developer/CommandLineTools #Using CommandLineTools SDK
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer #Using XCode.app SDK

Executing sudo make install in Eclipse CDT?

I'm contributing to OpenCV using Eclipse Neon.
I edited the Build command in Project->Proprieties->C/C++ Build->Build command as sudo make -j8 install, so when I build the project, Eclipse compiles OpenCV and then install it in my system.
However, this is the returned error:
sudo make -j8 install all
sudo: no tty present and no askpass program specified
I think that this is because sudo asks the password and Eclipse can't give it. How can I do this? I've found this [question][1] on the topic, but I didn't understood the given [answer][2]
Instead of using sudo use an alternative, which uses GUI, like gksudo on Gnome / LXDE or kdesudo on KDE.
If you want to use sudo, you have to put the line
john ALL = NOPASSWD: /usr/bin/make
into the file /etc/sudoers, where john is your user name and /usr/bin/make is the path to the make executable. With this line, you can start make with sudo, but without enter the credentials.
But instead of entering this line directly to /etc/sudoers, you should better call sudo visudo, which opens the sudoers file in an editor and if you close the program, it checks the changes you made on the file.

How to build and install Valgrind on Mac?

I am on Mac OS X using codeblocks 10.05
I downloaded Valgrind, and extracted a folder. I am completely lost from there, and have no idea how to build it.
I do not know ANY terminal/console commands and am generally new to programming, so I have no idea how to "build" or "compile" it. I just have a folder called Valgrind with a bunch of random files in it.
Could someone please tell me how to proceed? I already checked the website/documentation but it didn't really give me installation instructions, just usage instructions.
Thanks
PS: I know I already posted this question, but the previous question was shut down, for being too vague. I reposted this one with more info.
PSS: All that I am basically asking is what do I do to install Valgrind right after I download it from the website and extract the files?
Recommended:
Use brew: brew install valgrind
Manual Install:
Here's what worked on my Mac (10.6). Double-check you have the latest version, then change into the uncompressed directory
cd /users/(insert username here)/downloads/valgrind-3.17.0
I suggest you do as another posted and read the readme.
nano README
Commence the build; /usr/local is the place on the filesystem that the program will be installed to. There are many arguments like prefix that are available to customize the installation to your particular system if it doesn't work by default. Normally just using ./configure works perfectly well though.
./configure --prefix=/usr/local
make
sudo make install
Or you could probably get it from fink or macports or homebrew.
You can install it through brew for Mac:
brew install valgrind
You might have to manually link the entry to /usr/local/bin as brew refused to do it in my case:
$ ln /usr/local/Cellar/valgrind/3.8.1/bin/vgdb /usr/local/bin/vgdb
ln: /usr/local/bin/vgdb: Permission denied
$ sudo ln /usr/local/Cellar/valgrind/3.8.1/bin/vgdb /usr/local/bin/vgdb
On MacOS High Sierra
If you have the following error message:
brew install valgrind
valgrind: This formula either does not compile or function as expected on macOS
versions newer than Sierra due to an upstream incompatibility.
Fix
(1) To correctly install it, first, type the following command at the Terminal (which opens Valgrind’s formulae)
brew edit valgrind
And change the URL in head section
https://sourceware.org/git/valgrind.git
to
git://sourceware.org/git/valgrind.git
(2) Do an update for Homebrew:
brew update
(3) Finally, use the following command to install Valgrind from the HEAD:
brew install --HEAD valgrind
Sources
https://www.gungorbudak.com/blog/2018/04/28/how-to-install-valgrind-on-macos-high-sierra/
https://github.com/Homebrew/homebrew-core/issues/18998
For macOS Big Sur / Monterey:
brew tap LouisBrunner/valgrind
brew install --HEAD LouisBrunner/valgrind/valgrind
The core process is pretty simple:
Make sure you are in the correct directory.
First run:
./configure
when that is finished, run:
make
at this point you will need to su into root (this is relatively tricky to do, see the note at the end). As root, run:
make install
When this is finished you will have a working valgrind installation. Test it by running
valgrind ls -l
To su into root, you will need to have set up a root account. If you have not done this in the past, see the instructions from apple here.
To perform the actual su, you will first have to be running an account with administrator privileges. If you are not already doing so, you can switch users with the following:
su admin
where admin is the name of an user with administrator privileges (you will need to enter the password for this account). From there, you can then run su to go into root:
su
You will need to enter the root password that you set up earlier.
You may find it easier to use something like macports. How to install that is probably beyond the scope of this question, but they have a page dedicated to it on their site.
Once you have macports installed, you need to type:
sudo port install valgrind +universal
As you say you don't have any experience of command lines, let's just briefly go through the different parts of this command:
sudo means the rest of the command will run as root, and will ask for your password. This is needed for the installer to have the correct permissions
port is the command line tool for managing macports
install is a command for port. Try port help to see a list of commands.
valgrind tells macports what it should be installing
+universal is a variant. This tells macports to configure valgrind to support 32 bit and 64 bit support.