# Nix devShell use XCode command line tools for react native build

**URL:** https://discourse.nixos.org/t/nix-devshell-use-xcode-command-line-tools-for-react-native-build/26784
**Category:** Help
**Created:** [March 27, 2023, 11:34pm UTC](https://discourse.nixos.org/t/nix-devshell-use-xcode-command-line-tools-for-react-native-build/26784 "2023-03-27T23:34:32Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![eisfunke](https://discourse.nixos.org/user_avatar/discourse.nixos.org/eisfunke/32/16003_2.png) [@eisfunke](https://discourse.nixos.org/u/eisfunke)
#### Post date: [October 7, 2023, 10:43am UTC](https://discourse.nixos.org/t/nix-devshell-use-xcode-command-line-tools-for-react-native-build/26784/4 "2023-10-07T10:43:23Z")

</div>

A friend of mine ran into this problem, I found a solution:

It’s not `nix develop` that depends on clang, but rather `pkgs.mkShell`. It’s a wrapper around `stdenv.mkDerivation` (see [Nixpkgs 23.11 manual | Nix & NixOS](https://nixos.org/manual/nixpkgs/stable/#sec-pkgs-mkShell)). So it uses the `stdenv` build environment, which includes a C compiler, seemingly clang on macOS.

There’s also `stdenvNoCC`, which doesn’t include a C compiler. That’s useful for builds that don’t need one, and can also help here. So the solution is just to use `pkgs.mkShellNoCC` instead of `pkgs.mkShell`, which is an (sadly undocumented) variant of `mkShell` that overrides `stdenv` with `stdenvNoCC`.

(it’s defined in `all-packages.nix` from nixpkgs: `mkShellNoCC = mkShell.override { stdenv = stdenvNoCC; };`)

I haven’t tested this myself with react-native, but the friend confirmed it works with react-native and mkShellNoCC.

Note: [https://github.com/viperML/mkshell-minimal](https://github.com/viperML/mkshell-minimal) as suggested by @azuwis should work too as it also doesn’t include a C compiler, but `mkShellNoCC` is included in nixpkgs anyway, so it might be easier to use.

Edit: I made a PR to add a little documentation section for mkShellNoCC: [doc: add section about mkShellNoCC by Eisfunke · Pull Request #259567 · NixOS/nixpkgs · GitHub](https://github.com/NixOS/nixpkgs/pull/259567)

---

_[View the full topic](https://discourse.nixos.org/t/nix-devshell-use-xcode-command-line-tools-for-react-native-build/26784)._
