vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

Install location requires sudo

Open spinicist opened this issue 7 years ago • 8 comments

Brief Issue Summary

I would like to install my project to /usr/local using the install CMake target. On my (Mac) system this requires sudo permissions. Instead of asking for permissions, CMake Tools simply fails. I can run sudo ninja install from the command-line. However, if CMake has to build a binary during this step, it will be written with the owner set to root. Then, if I make another target within CMake Tools, e.g. all, it will fail because it cannot overwrite the file.

Expected:

Somehow CMake Tools asks for my password so that I can install to /usr/local.

Other Notes/Information

I admit this may be a difficult problem to solve well. The reason I would like to install to /usr/local is that I use BATS as my test framework, and since Apple added System Integrity Protection (SIP) to Mac OS X, child processes no longer receive the DYLD_LIBRARY_PATH variable in their environment. This means my BATS tests cannot find my shared libraries, unless they are installed to a system path such as /usr/local 😡

If anyone has a better suggestion as a workaround, I am all ears.

spinicist avatar Mar 19 '18 22:03 spinicist

Recently code introduced ability to save files as administrator. Wonder if could implement similar feature on all platforms. Only issue though is to detect when it is needed...

ytimenkov avatar Mar 20 '18 10:03 ytimenkov

Yup, that's exactly the problem I thought of once I'd had a while to think. Do not consider this high priority! I have found another work-around (re-sourcing .bash_profile in my BATS tests).

spinicist avatar Mar 20 '18 12:03 spinicist

Any update on this feature request?

Tudyx avatar Jun 08 '21 13:06 Tudyx

We were not able to get to this yet but we would happily review and test a PR from the community, if anyone is willing to spend the time to implement this.

andreeis avatar Jun 09 '21 21:06 andreeis

Any updates on this feature? I almost always install to a location that requires sudo privileges. I have a library that is built by me alongisde an executable in the same workspace (although two entirely separate projects). Since I am installing the library to include in the executable, each time I build I have to manually copy the cmake install command and add "sudo". The only solution for me at the moment is installing to a non-standard prefix.

gvcallen avatar Oct 03 '21 15:10 gvcallen

would like to see this also.

DominionSoftware avatar Jan 21 '22 21:01 DominionSoftware

I imagine that this feature request is somewhat related to: https://github.com/microsoft/vscode-cmake-tools/issues/532

Zingam avatar Nov 04 '23 07:11 Zingam

It looks like https://github.com/microsoft/vscode-cmake-tools/issues/532 is implemented, which makes this issue even more relevant. @gcampbell-msft Would you consider triaging this issue now?

Zingam avatar May 05 '24 11:05 Zingam

@Zingam Thanks for following up.

As a workaround, are you able to simply open your project in VS Code as a sudo user?

gcampbell-msft avatar May 24 '24 14:05 gcampbell-msft