xcodebuild wants to write to $HOME/Library/Developer (was: Re: Editing Git history with GitUp)

Rainer Müller raimue at macports.org
Mon Apr 2 17:11:48 UTC 2018


On 2018-03-23 11:17, Mojca Miklavec wrote:
> I just stumbled upon this app (I haven't tested it yet) which might be
> able to avoid some pain when editing git history before pushing your
> changes upstream:
>     http://gitup.co

Thank you for the this tip. I especially like the visualization of
branches in GitUp a lot.

As GitUp is open source software, I tried to create a port for it.
However, I ran into strange problems with xcodebuild.

Here is the work in progress Portfile:
https://github.com/raimue/macports-ports/blob/gitup/devel/GitUp/Portfile

The build fails with this error message (ignoring other messages from
com.apple.CoreSimulator.SimError, which I have seen before and seem
harmless):

---
Build Preparation
Couldn't create workspace arena folder '/opt/local/var/macports/home/Library/Developer/Xcode/DerivedData/GitUp-fnbahhvyzxfjjddhqkxlurazjuhj': You don’t have permission to save the file “GitUp-fnbahhvyzxfjjddhqkxlurazjuhj” in the folder “DerivedData”.
Couldn't create module cache folder '/opt/local/var/macports/home/Library/Developer/Xcode/DerivedData/ModuleCache': Unable to create directory: /opt/local/var/macports/home/Library/Developer/Xcode/DerivedData/ModuleCache (Operation not permitted)
Couldn't update module cache session file '/opt/local/var/macports/home/Library/Developer/Xcode/DerivedData/ModuleCache/Session.modulevalidation': The folder “Session.modulevalidation” doesn’t exist.
---

My system is currently running:
macOS 10.12.6 16G1212
Xcode 9.2 9C40

The problem here is that xcodebuild is not respecting $HOME from the
environment, but uses the home directory of the macports user as set in
directory service. This path is not writable, as it is shared between
all port builds and we do not want builds to influence each other.

As you can see in the Portfile linked above, I already tried to pass an
explicit HOME variable and also some other variables that the Xcode
build settings reference [1] suggested.

The commented line can be used to make xcodebuild dump all build
settings and their values.

Do we have any Xcode experts with another idea which path setting needs
to be changed to avoid accessing $HOME/Library/Developer?

Rainer

[1] Current: http://help.apple.com/xcode/mac/9.3/#/itcaec37c2a6 (could not find the same for 9.2)
    Retired: https://developer.apple.com/legacy/library/documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW51 (more detailed)


More information about the macports-dev mailing list