{"id":34299,"date":"2021-11-26T15:00:58","date_gmt":"2021-11-26T20:00:58","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=34299"},"modified":"2021-11-26T15:00:58","modified_gmt":"2021-11-26T20:00:58","slug":"xcodes-environmental-pollution","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2021\/11\/26\/xcodes-environmental-pollution\/","title":{"rendered":"Xcode&rsquo;s Environmental Pollution"},"content":{"rendered":"<p><a href=\"https:\/\/indiestack.com\/2021\/11\/xcodes-environmental-pollution\/\">Daniel Jalkut<\/a> (<a href=\"https:\/\/twitter.com\/danielpunkass\/status\/1462899381024215053\">tweet<\/a>):<\/p>\n<blockquote cite=\"https:\/\/indiestack.com\/2021\/11\/xcodes-environmental-pollution\/\"><p>After a lot of trial and error, I came across the strangest observation: if I invoke &ldquo;xcodebuild&rdquo; from within my Python-based build script, the warning is emitted. If I invoke it directly from the Terminal, it isn&rsquo;t. In fact, if I simplify my build script to simply invoking &ldquo;xcodebuild&rdquo;, the warning happens. Stranger still? If I change the script from &ldquo;python3&rdquo; to just &ldquo;python&rdquo;, the warning goes away again.<\/p>\n<p>[&#8230;]<\/p>\n<p>Sure enough, the environment variables differed when I ran the script with &ldquo;python&rdquo; vs. &ldquo;python3&rdquo;.<\/p>\n<p>[&#8230;]<\/p>\n<p>That &ldquo;CPATH&rdquo; entry for example only exists when invoking the script with python3, and it&rsquo;s this very environment variable that is creating the unexpected Xcode warnings!<\/p>\n<p>I was perplexed about how or why the version of Python could impact these environment variables, but then I remembered that python3 is bundled in Xcode itself, and the version at \/usr\/bin\/python3 is a special kind of shim binary that directs Apple to locate and run the Xcode-bundled version of the tool. Apparently, a side-effect of this mechanism causes the problematic environment variable to be set!<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Daniel Jalkut (tweet): After a lot of trial and error, I came across the strangest observation: if I invoke &ldquo;xcodebuild&rdquo; from within my Python-based build script, the warning is emitted. If I invoke it directly from the Terminal, it isn&rsquo;t. In fact, if I simplify my build script to simply invoking &ldquo;xcodebuild&rdquo;, the warning happens. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2021-11-26T20:01:01Z","apple_news_api_id":"4940ddd1-2c9c-409b-8f33-3b8bd3394a02","apple_news_api_modified_at":"2021-11-26T20:01:01Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/ASUDd0SycQJuPMzuL0zlKAg","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[30,2077,71,232,226],"class_list":["post-34299","post","type-post","status-publish","format-standard","hentry","category-technology","tag-mac","tag-macos-12","tag-programming","tag-python","tag-xcode"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/34299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=34299"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/34299\/revisions"}],"predecessor-version":[{"id":34300,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/34299\/revisions\/34300"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=34299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=34299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=34299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}