Skip to content

Commit

Permalink
[post update] xcode shell env
Browse files Browse the repository at this point in the history
  • Loading branch information
jessesquires committed Dec 15, 2023
1 parent f391117 commit 31d7aa6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions _posts/2023-12-06-xcode-shell-env.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ categories: [software-dev]
tags: [xcode, apple-silicon, m3, homebrew]
date: 2023-12-06T10:19:56-08:00
title: Xcode does not have access to your shell environment
date-updated: 2023-12-15T15:50:32-08:00
---

I recently discovered, while [setting up my first Apple Silicon Mac]({% post_url 2023-12-04-new-m3-mbp %}), that Xcode does not have access to your shell environment. But there's one caveat to that. (Thanks to [Boris for confirming](https://mastodon.social/@NeoNacho/111494454201420440#.)!) This post will hopefully be a reminder to my future self when I encounter this issue again.
Expand All @@ -21,3 +22,11 @@ export PATH="$PATH:/opt/homebrew/bin"
{% include break.html %}

Anyway, the moral of this story is that Xcode does not have access to your shell environment. This is not necessarily an obvious thing, especially on Intel machines. Xcode only gets whatever the default `PATH` is, configured via launch services --- **unless** you launch it through a terminal. What this means is that `xcodebuild` run from terminal and Xcode could end up with potentially different behavior in their Run Script Build Phases because they expose different environments. Good to know!

{% include updated_notice.html
date="2023-12-15T15:50:32-08:00"
message="
Thanks to Dave for [linking to this post this week](https://iosdevweekly.com/issues/640?#tools) and sharing a very relevant tip on this topic:

> Don’t forget you can still set environment variables from your project’s scheme configuration. Edit your scheme from the Product menu, select the Arguments tab against the Run behaviour, and set Environment Variables.
" %}

0 comments on commit 31d7aa6

Please sign in to comment.