Command Line Tools

RSS for tag

Command line tools allow for easy installation of open source software or development on UNIX within Terminal.

Posts under Command Line Tools tag

112 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Pinning an item on MacOS's dock programatically
I want to pin an item (an app or a .webloc file) in the MacOS dock. Has apple provided an API for this? I have seen in other forums that it could be done using the following command. defaults write com.apple.dock persistent-others -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>" **file/location** "</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>' This command adds the item in the com.apple.dock.plist file, which stores all the items present in the dock. This file is present in ~/Library/Preferences/. But the dock needs to be killed once first for the item to show as pinned in it after running the command . Killing the dock can have undesirable effects, for example it maximises the minimised apps and files. Is there any way to pin the item without killing the dock?
2
0
450
Sep ’23
Can't upgrade XCode Command Line Tools
My current installation of XCode Command Line Tools behaves like this: $ xcode-select -p /Library/Developer/CommandLineTools $ /Library/Developer/CommandLineTools/usr/bin/clang --version Apple LLVM version 10.0.1 (clang-1001.0.46.4) Target: x86_64-apple-darwin18.7.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin $ xcode-select --version xcode-select version 2354. $ xcode-select --install xcode-select: error: command line tools are already installed, use "Software Update" to install updates Nothing new appears under Software Update so I thought I'd try to download a package directly and install that. Trying to install any of the following versions of Command Line Tools for Xcode: 15 beta 7 14 13 from https://developer.apple.com/download/all/?q=command%20xcode gives an error like this: About This Mac says I'm running macOS 10.14.6 (18G9323) on a MacBook Pro (15-inch, Mid 2012) 14.6 would seem to be more recent than 13.4. I don't have XCode itself installed but I shouldn't need that, should I? What else am I missing?
1
0
1.4k
Sep ’23
/Library/Developer/CommandLineTools/usr/bin/make stopped working with latest OSX update
I updated to the latest OSX 13.5.1 (22G90) and the make command stopped working. It just hangs. Any help would be appreciated. Here is the sample result: Analysis of sampling make (pid 86819) every 1 millisecond Process: make [86819] Path: /Library/Developer/CommandLineTools/usr/bin/make Load Address: 0x1032ae000 Identifier: make Version: 135 Code Type: X86-64 Platform: macOS Parent Process: zsh [2964] Date/Time: 2023-08-28 14:56:59.715 -0400 Launch Time: 2023-08-28 14:56:22.791 -0400 OS Version: macOS 13.5.1 (22G90) Report Version: 7 Analysis Tool: /usr/bin/sample Physical footprint: 768K Physical footprint (peak): 768K Idle exit: untracked ---- Call graph: 2596 Thread_24457592 DispatchQueue_1: com.apple.main-thread (serial) 2596 start (in dyld) + 1903 [0x7ff813c6f41f] 2596 ??? (in make) load address 0x1032ae000 + 0x12582 [0x1032c0582] 2596 ??? (in make) load address 0x1032ae000 + 0x1518b [0x1032c318b] 2596 ??? (in make) load address 0x1032ae000 + 0x15478 [0x1032c3478] 2596 ??? (in make) load address 0x1032ae000 + 0x15ce7 [0x1032c3ce7] 2596 ??? (in make) load address 0x1032ae000 + 0x1da2f [0x1032cba2f] 2596 ??? (in make) load address 0x1032ae000 + 0x1cbe2 [0x1032cabe2] 2596 ??? (in make) load address 0x1032ae000 + 0x8699 [0x1032b6699] 2596 ??? (in make) load address 0x1032ae000 + 0x87d1 [0x1032b67d1] 2596 ??? (in make) load address 0x1032ae000 + 0xad68 [0x1032b8d68] 2596 ??? (in make) load address 0x1032ae000 + 0xbe8c [0x1032b9e8c] 2596 read (in libsystem_kernel.dylib) + 10 [0x7ff813f8afee] Total number in stack (recursive counted multiple, when >=5): Sort by top of stack, same collapsed (when >= 5): read (in libsystem_kernel.dylib) 2596
8
0
823
Aug ’23
Linker Command failed
We are developing an application for iOS in Xamarin in Visual Studio (XCode CLT 14.3.1 on a MacBook Pro with M2 Chip and Ventura). We have a Woosim Printer, where the sdk is written in c++ but uses Swift modules. When i try to add the .dll in the project i get the following errors. I added these flags to the project: --gcc_flags -L/usr/lib/swift --gcc_flags -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos --gcc_flags "-Wl,-rpath -Wl,@executable_path/Frameworks“ Does anybody know, what am i doing wrong? Or is this a linkerproblem?
0
0
437
Aug ’23
Command Line Utility vs. Core Bluetooth Permissions
I'm writing a command line tool for macOS which interfaces with BLE devices. I have a problems with regards to permissions: If I launch my tool on the command line, it gets killed by the OS. Only if I launch it via the debugger, I get the alerter to allow the bluetooth permission. My plist that contains the NSBluetoothAlwaysUsageDescription key is embedded as __TEXT __info_plist in the binary. Is this no longer enough for a command-line tool to access security-guarded OS facilities these days?
2
0
2k
Aug ’23
Unable to install Command Line Developer Tools
Hi, I am trying to reinstall ffmpeg n terminal however keep getting a message saying. Error: python 3.9: the bottle needs the Apple Command Line Tools to be installed. You can install them, if desired, with: xcode-select --install So I enter xcode-select --install in terminal and a window opens telling me the xcode select command requires the command line developer tools and do I wish to install the. I click on Install and get agreement window which I agree and then two windows: "Continue on battery power" and :Finding Software" If I click 'Continue on battery power", immediately the progress bar jumps to about 1/6 progress and then never moves any further. With or without a mains lead connected? Any help to resolve this? I have seen advice on installing the command line tools direct from the Apple Developer Page, but cannot find a correct link. Many thanks.
1
0
1.6k
Aug ’23
Investigating Third-Party IDE Integration Problems
I regularly see questions from folks who’ve run into problems with their third-party IDE on macOS. Specifically, the issue is that their IDE is invoking Apple’s command-line tools — things like clang and ld — and that’s failing in some way. This post collects my ideas on how to investigate, and potentially resolve, issues like this. If you have any questions or comments, please put them in a new thread here on DevForums. Tag it appropriately so that I see it. Good tags include Compiler, Linker, LLVM, and Command Line Tools. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com" Investigating Third-Party IDE Integration Problems Many third-party IDEs rely on Apple tools. For example, the IDE might run clang to compile C code or run ld to link object files. These IDEs typically don’t include the tools themselves. Rather, they rely on you to install Xcode or Apple’s Command Line Tools package. These are available at Apple > Developer > Downloads Occasionally I see folks having problems with this. They most typically report that basic stuff, like compiling a simple C program, fails with some mysterious error. If you’re having such a problem, follow the steps below to investigate it. IMPORTANT Some IDEs come with their own tools for compiling and linking. Such IDEs are not the focus of this post. If you have problems with an IDE like that, contact its vendor. Select Your Tools macOS has a concept of the current command-line tools. This can either point to the tools within Xcode or to an installed Command Line Tools package. To see which tools are currently selected, run xcode-select with the --print-path argument. This is what you’ll see if you have Xcode installed in the Applications folder: % xcode-select --print-path /Applications/Xcode.app/Contents/Developer Note All of the tools I discuss here are documented in man pages. If you’re not familiar with those, see Reading UNIX Manual Pages. And this is what you’ll see with a Command Line Tools package selected. % xcode-select --print-path /Library/Developer/CommandLineTools There are two common problems with this: It points to something you’ve deleted. It points to something unexpected. Run the command above to see the current state. If necessary, change the state using the --switch option. For example: % xcode-select --print-path /Applications/Xcode.app/Contents/Developer % clang -v Apple clang version 14.0.3 (clang-1403.0.22.14.1) … % sudo xcode-select --switch ~/XcodeZone/Xcode-beta.app % clang -v Apple clang version 15.0.0 (clang-1500.0.38.1) … I have Xcode 14.3 in the Applications foledr and thus clang runs Clang 14.0.3. I have Xcode 15.0b5 in ~/XcodeZone, so switching to that yields Clang 15.0.0. It’s possible to run one specific command with different tools. See Select Your Tools Temporarily, below. Run a Simple Test A good diagnostic test is to use the selected command-line tools to compile a trivial test program. Consider this C [1] example: % cat hello.c #include <stdio.h> int main(int argc, char ** argv) { printf("Hello Cruel World!\n"); return 0; } % clang -o hello hello.c % ./hello Hello Cruel World! IMPORTANT If possible, run this from Terminal rather than, say, over SSH. You may need to expand this test program to exercise your specific case. For example, if your program is hitting an error when it tries to import the Core Foundation framework, add that import to your test program: % cat hello.c #include <stdio.h> #include <CoreFoundation/CoreFoundation.h> int main(int argc, char ** argv) { printf("Hello Cruel World!\n"); return 0; } When you compile your test program, you might see one of these results: Your test program compiles. Your test program fails with a similar error. Your test program fails with a different error. I’ll explore each case in turn. [1] For a C++ example, see C++ Issues, below. If your test program compiles… If your test program compiles from the shell, that proves that your basic command-line tools setup is fine. If the same program fails to compile in your IDE, there’s something IDE-specific going on here. I can’t help you with that. I recommend that you escalate the issue via the support channel for your IDE. If your test program fails with a similar error… If your test program fails with an error similar to the one you’re seeing in your IDE, there are two possibilities: There’s a bug in your test program’s code. There’s an environmental issue that’s affecting your command-line tools setup. Don’t rule out the first possibility. I regularly see folks bump into problems like this, where it turns out to be a bug in their code. For a specific example, see C++ Issues, below. Assuming, however, that your test program’s code is OK, it’s time to investigate environmental issues. See Vary Your Environment, below. If your test program fails with a different error… If your test program fails with a different error, look at the test program’s code to confirm that it’s correct, and that it accurately reflects the code you’re trying to run in your IDE. Vary Your Environment If your test program fails with the same error as you’re seeing in your IDE, and you are sure that the code is correct, it’s time to look for environmental factors. I typically do this with the steps described in the next sections, which are listed from most to least complex. These steps only tell you where things are going wrong, not what is going wrong. However, that’s often enough to continue the investigation of your issue. Vary Your Shell Try running your commands in a different shell. macOS’s default shell is zsh. Try running your commands in bash instead: % bash … bash-3.2$ clang -o hello hello.c bash-3.2$ ./hello Hello Cruel World! Or if you’ve switched your shell to bash, try it in zsh. Vary Your User Account Some problems are caused by settings tied to your user account. To investigate whether that’s an issue here: Use System Settings > Users & Groups to create a new user. Log in as that user. Run your test again. Vary Your Mac Some problems are system wide, so you need to test on a different Mac. The easiest way to do that is to set up a virtual machine (VM) and run your test there. Or, if you have a separate physical Mac, run your test on that. Vary Your Site If you’re working for an organisation, they may have installed software on your Mac that causes problems. If you have a Mac at home, try running your test there. It’s also possible that your network is causing problems [1]. If you have a laptop, try taking it to a different location to see if that changes things. [1] I rarely see this when building a simple test program, but it do see it with other stuff, like code signing. C++ Issues If you’re using C++, here’s a simple test you can try: % cat hello.cpp #include <iostream> int main() { std::cout << "Hello Cruel World!\n"; } % clang++ -o hello hello.cpp % ./hello Hello Cruel World! A classic problem with C++ relates to name mangling. Consider this example: % cat hello.c #include <stdio.h> #include "hello-core.h" int main(int argc, char ** argv) { HCSayHello(); return 0; } % cat hello-core.cpp #include "hello-core.h" #include <iostream> extern void HCSayHello() { std::cout << "Hello Cruel World!\n"; } % cat hello-core.h extern void HCSayHello(); % clang -c hello.c % clang++ -c hello-core.cpp % clang++ -o hello hello.o hello-core.o Undefined symbols for architecture x86_64: "_HCSayHello", referenced from: _main in hello.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) The issue here is that C++ generates a mangled name for HCSayHello: % nm hello-core.o | grep HCSayHello 0000000000000000 T __Z10HCSayHellov whereas C uses the non-mangled name: % nm hello.o | grep HCSayHello U _HCSayHello The fix is an appropriate application of extern "C": % cat hello-core.h extern "C" { extern void HCSayHello(); }; Select Your Tools Temporarily Sometimes you want to temporarily run a command from a particular tools package. To continue my earlier example, I currently have Xcode 14.3 installed in the Applications folder and Xcode 15.0b5 in ~/XcodeZone. Xcode 14.3 is the default but I can override that with the DEVELOPER_DIR environment variable: % clang -v Apple clang version 14.0.3 (clang-1403.0.22.14.1) … % DEVELOPER_DIR=~/XcodeZone/Xcode-beta.app/Contents/Developer clang -v Apple clang version 15.0.0 (clang-1500.0.38.1) …
0
0
683
Jul ’23
Persistent "libcrypto loading in an unsafe way" Error with Ruby on Rails on macOS
Hello, I am using a 2017 MacBook Pro with an Intel chip, running Ruby version 2.7.8, Rails 5.2.6, and OpenSSL 1.1. I've installed Ruby using rbenv and ruby-build. I am persistently receiving the following error when trying to create a database with Rails: WARNING: /Users/logan/.rbenv/versions/2.7.8/bin/ruby is loading libcrypto in an unsafe way zsh: abort bundle exec bin/rails db:create Steps I have taken to troubleshoot this issue: Installed OpenSSL via Homebrew and ensured that the version is 1.1. Uninstalled and reinstalled Ruby with rbenv, specifying the correct OpenSSL directory. Set the DYLD_LIBRARY_PATH environment variable to the path where Homebrew installed the OpenSSL libraries before running the Ruby process. Unfortunately, none of these steps have resolved the problem. I am seeking assistance in resolving this issue. Any guidance or insight into what might be causing this error and how to fix it would be greatly appreciated. Thank you in advance for your time and help!
0
0
759
Jul ’23
Xcode build tools producing empty dSYM file
Hello! I’m currently trying to build my iOS project from the command line including all symbols with dSYMs. Some information about my project: I have two different targets in addition to libraries imported with a mix of Cocoapods and SwiftPM The debug information format for all targets is “DWARF with dSYM File” The issue I’m having is that after dSYM files are created, there is one empty one. The empty one always ends up being the actual app’s dSYM file. So the second target and all dependency dSYM files are created successfully, but the main app dSYM file is completely empty. Strangely, it works properly in about 1 out of every 20 builds. I’m building the app with the following command: 
 xcodebuild clean archive -workspace $WORKSPACE/workspaceName -scheme “appName-$ENV" -archivePath $WORKSPACE/build/xcarchive name -destination 'generic/platform=iOS' || exit 1 I run the build command from a build server that uses Jenkins. When I run this locally, or build from Xcode, this problem does not occur. It seems to be isolated to only the build server. Xcode version: 14.3 MacOS version: 13.3.1 Any suggestions on why this might be happening?
0
0
828
Jul ’23