# Xcode Environment Variables

**URL:** <https://forums.swift.org/t/xcode-environment-variables/45249>\
**Category:** Using Swift\
**Tags:** xcode, packagemanager, environment\
**Created:** [March 3, 2021, 3:13am UTC](https://forums.swift.org/t/xcode-environment-variables/45249 "2021-03-03T03:13:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shahzadmajeed](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/shahzadmajeed/32/14192_2.png) [@shahzadmajeed](https://forums.swift.org/u/shahzadmajeed)\
**Post date:** [March 3, 2021, 3:13am UTC](https://forums.swift.org/t/xcode-environment-variables/45249/1 "2021-03-03T03:13:15Z")

</div>

Is it possible to set environment variable before resolving dependencies for a swift package? I am trying to use CombineX [GitHub - cx-org/CombineX: Open source implementation of Apple's Combine](https://github.com/cx-org/CombineX). CXShim version is switches b/w Apple Combine and CombineX based on a set environment variable. They default to Apple Combine if CombineX package can't find this environment variable. Now I set this variable CX\_COMBINE\_IMPLEMENTATION="CombineX" in project scheme but Xcode doesn't seem to load environment variables.

Any idea how to fix this? Or any better approach?

Thanks!

---

<div class="post-metadata">

**Author:** ![SDGGiesbrecht](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sdggiesbrecht/32/4768_2.png) [@SDGGiesbrecht](https://forums.swift.org/u/SDGGiesbrecht)\
**Post date:** [March 3, 2021, 4:42am UTC](https://forums.swift.org/t/xcode-environment-variables/45249/2 "2021-03-03T04:42:59Z")

</div>

If you are asking how to work around it, see this thread:

> [@How to switch package dependencies in Xcode after deprecation of 'generate-xcodeproj'?](https://forums.swift.org/t/how-to-switch-package-dependencies-in-xcode-after-deprecation-of-generate-xcodeproj/42130):
>
> Xcode can now directly open "Package.swift" to edit sources, run tests, and so on. As a result, ['generate-xcodeproj' will be deprecated](https://github.com/apple/swift-package-manager/pull/3062). Imagine the world where you cannot use 'generate-xcodeproj'. And the following "Package.swift" is given. // swift-tools-version:5.3 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription import Foundation let dependencies: [Package.Dependency] if ProcessInfo.processInfo.environment["USE\_A…

If you are asking for a new Xcode feature to make it more ergonomic, that request should be made with Apple’s Feedback Assistant or at least over on the Apple Developer Forums. (Xcode is not part of Swift.)

---

<div class="post-metadata">

**Author:** ![shahzadmajeed](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/shahzadmajeed/32/14192_2.png) [@shahzadmajeed](https://forums.swift.org/u/shahzadmajeed)\
**Post date:** [March 3, 2021, 4:46am UTC](https://forums.swift.org/t/xcode-environment-variables/45249/3 "2021-03-03T04:46:06Z")

</div>

Sorry for posting irrelevant stuff here. But yes I was wondering if there is any workaround available. I will check the thread you mentioned. Thanks!
