Skip to content

unable to find utility *, not a developer tool or in PATH #3931

Closed

Description

@rolfbjarne

Steps to Reproduce

  1. Ensure the system Xcode (as defined by xcode-select -p) points to a different Xcode than Visual Studio for Mac.
  2. Execute xcrun -k
  3. Create an iOS project, makes sure it has multiple architectures selected (and device-specific builds disabled), and build it.

Result:

lipo : error : unable to find utility "lipo", not a developer tool or in PATH

The error can be reproduced directly on the command line as well:

xcrun -k
$ DEVELOPER_DIR=/Applications/Xcode92.app XCODE_DEVELOPER_DIR_PATH=/Applications/Xcode93.app/Contents/Developer xcrun lipo
xcrun: error: unable to find utility "lipo", not a developer tool or in PATH

The problem is the XCODE_DEVELOPER_DIR_PATH environment variable, which confuses Apple's tooling (when building an XI or XM project the variable is inherited from Visual Studio for Mac, which sets it).

Workarounds

  • Make sure the system Xcode and the VSfM Xcode is the same.

  • Run xcrun once without the variable (per broken tool) so that the tool's path is cached:

    $ xcrun -k
    $ xcrun clang --version
    Apple LLVM version 9.0.0 (clang-900.0.39.2)
    [...]
    $ DEVELOPER_DIR=/Applications/Xcode92.app XCODE_DEVELOPER_DIR_PATH=/Applications/Xcode93.app/Contents/Developer xcrun clang --version
    Apple LLVM version 9.0.0 (clang-900.0.39.2)
    [...]

Potential fixes

  1. Make mtouch and mmp unset XCODE_DEVELOPER_DIR_PATH unconditionally.
  2. Make VSfM unset XCODE_DEVELOPER_DIR_PATH. Presumably there's a reason it's set in the first place, so this might be non-trivial.

I think making mtouch and mmp unset the variable is the simplest and fastest to implement.

Activity

  1. added
    enhancement
    macOS
    iOS
    on Apr 13, 2018
  2. added this to the Future milestone on Apr 13, 2018
  3. madhurig commented on May 9, 2018

    @madhurig

    Is there a way to change "VS for Mac" Xcode settings without going through the UI? We have a customer running into this on the VSTS Hosted macOS VMs and we are looking for a way to switch the "VS for mac" default via a script.

    Thanks,
    Madhuri

  4. rolfbjarne commented on May 10, 2018

    @rolfbjarne
    MemberAuthor

    @madhurig it's stored in ~/Library/Preferences/Xamarin/Settings.plist:

    $ cat ~/Library/Preferences/Xamarin/Settings.plist 
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    	<key>AppleSdkRoot</key>
    	<string>/Applications/Xcode93.app</string>
    </dict>
    </plist>
  5. DelcoigneYves commented on Aug 8, 2018

    @DelcoigneYves

    I managed to work around it on our build system by reading out the path located in the Settings.plist, and setting the DEVELOPER_DIR environment variable to this path, appended with "/Contents/Developer".

  6. VincentDondain commented on Oct 18, 2018

    @VincentDondain
    Contributor

    @rolfbjarne we might also want to create an IDE issue. The IDE could get the Xcode path from xcode-select -p and also set a new Xcode path with xcode-select -s from the UI. What do you think?

  7. rolfbjarne commented on Oct 18, 2018

    @rolfbjarne
    MemberAuthor

    @VincentDondain yes, that's another solution that should work just as fine.

  8. VincentDondain commented on Oct 18, 2018

    @VincentDondain
    Contributor

    Also it's what Xcode does.

  9. 5 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementiOSmacOS

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions