{"id":33400,"date":"2021-08-16T16:23:38","date_gmt":"2021-08-16T20:23:38","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=33400"},"modified":"2021-08-16T16:23:38","modified_gmt":"2021-08-16T20:23:38","slug":"switching-xcode-versions-without-a-password","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2021\/08\/16\/switching-xcode-versions-without-a-password\/","title":{"rendered":"Switching Xcode Versions Without a Password"},"content":{"rendered":"<p><a href=\"https:\/\/www.smileykeith.com\/2021\/08\/12\/xcode-select-sudoers\/\">Keith Smiley<\/a>:<\/p>\n<blockquote cite=\"https:\/\/www.smileykeith.com\/2021\/08\/12\/xcode-select-sudoers\/\"><pre>sudo xcodebuild -runFirstLaunch<\/pre><p>This works fine locally, but when updating remote CI machines, entering\nthe password can be troublesome. Furthermore if you want to support\nhaving CI machines automatically switch between Xcode versions when\ntesting upcoming changes, you may not have the opportunity to be\nprompted at all. Lucky for us, the <a href=\"https:\/\/keith.github.io\/xcode-man-pages\/sudoers.5.html\"><tt>sudoers<\/tt><\/a> file format,\nwhich configures the <code>sudo<\/code> command, allows us to skip password entry\nfor specific commands with a bit of configuration.<\/p><p>[&#8230;]<\/p><ol><li>We specify just the <code>xcode-select<\/code> binary, using the absolute path.\nThis allows all subcommands handled by <code>xcode-select<\/code> to be run\nwithout a password.<\/li><li>The <code>xcodebuild<\/code> command also contains the one subcommand we want to\nbe able to run without a password. Limiting this is important because\notherwise you could run <code>sudo xcodebuild build<\/code> without a password,\nwhich could execute malicious run scripts or do other terrible\nthings.<\/li><\/ol><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Keith Smiley: sudo xcodebuild -runFirstLaunchThis works fine locally, but when updating remote CI machines, entering the password can be troublesome. Furthermore if you want to support having CI machines automatically switch between Xcode versions when testing upcoming changes, you may not have the opportunity to be prompted at all. Lucky for us, the sudoers file [&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-08-16T20:23:42Z","apple_news_api_id":"8765981d-4b3a-4a2b-af3e-9ebe7573813f","apple_news_api_modified_at":"2021-08-16T20:23:42Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/Ah2WYHUs6SiuvPp6-dXOBPw","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,1891,71,582,268,226],"class_list":["post-33400","post","type-post","status-publish","format-standard","hentry","category-technology","tag-mac","tag-macos-11-0","tag-programming","tag-sudo","tag-testing","tag-xcode"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/33400","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=33400"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/33400\/revisions"}],"predecessor-version":[{"id":33401,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/33400\/revisions\/33401"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=33400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=33400"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=33400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}