[TIL]xcrun: error: invalid active developer path

jake.log·2021년 12월 8일
0

mac os 업데이트를 한 후 mysqllcient를 설치하는데
xcrun: error: invalid active developer path와
command 'gcc' failed with exit status 1 에러가 났다.

ERROR: Command errored out with exit status 1:
   command: /Users/jake_hong/miniconda3/envs/logitech/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/5t/6gk39nps1xv2cygwgj2lq8rm0000gn/T/pip-install-874ij9kc/mysqlclient_fc55de34f29b49d2b4257183fbda80c7/setup.py'"'"'; __file__='"'"'/private/var/folders/5t/6gk39nps1xv2cygwgj2lq8rm0000gn/T/pip-install-874ij9kc/mysqlclient_fc55de34f29b49d2b4257183fbda80c7/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/5t/6gk39nps1xv2cygwgj2lq8rm0000gn/T/pip-wheel-2aavvscz
       cwd: /private/var/folders/5t/6gk39nps1xv2cygwgj2lq8rm0000gn/T/pip-install-874ij9kc/mysqlclient_fc55de34f29b49d2b4257183fbda80c7/
  Complete output (41 lines):
  mysql_config --version
  ['8.0.27']
  mysql_config --libs
  ['-L/usr/local/Cellar/mysql/8.0.27/lib', '-lmysqlclient', '-lz', '-lzstd', '-lssl', '-lcrypto', '-lresolv']
  mysql_config --cflags
  ['-I/usr/local/Cellar/mysql/8.0.27/include/mysql']
  ext_options:
    library_dirs: ['/usr/local/Cellar/mysql/8.0.27/lib']
    libraries: ['mysqlclient', 'resolv']
    extra_compile_args: ['-std=c99']
    extra_link_args: []
    include_dirs: ['/usr/local/Cellar/mysql/8.0.27/include/mysql']
    extra_objects: []
    define_macros: [('version_info', "(2,1,0,'final',0)"), ('__version__', '2.1.0')]
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-x86_64-3.8
  creating build/lib.macosx-10.9-x86_64-3.8/MySQLdb
  copying MySQLdb/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
  copying MySQLdb/_exceptions.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
  copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
  copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
  copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
  copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
  copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
  creating build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
  copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
  copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
  copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
  copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
  copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
  copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
  running build_ext
  building 'MySQLdb._mysql' extension
  creating build/temp.macosx-10.9-x86_64-3.8
  creating build/temp.macosx-10.9-x86_64-3.8/MySQLdb
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/jake_hong/miniconda3/envs/logitech/include -arch x86_64 -I/Users/jake_hong/miniconda3/envs/logitech/include -arch x86_64 -Dversion_info=(2,1,0,'final',0) -D__version__=2.1.0 -I/usr/local/Cellar/mysql/8.0.27/include/mysql -I/Users/jake_hong/miniconda3/envs/logitech/include/python3.8 -c MySQLdb/_mysql.c -o build/temp.macosx-10.9-x86_64-3.8/MySQLdb/_mysql.o -std=c99
  xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for mysqlclient
  Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
    Running setup.py install for mysqlclient ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/jake_hong/miniconda3/envs/logitech/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/5t/6gk39nps1xv2cygwgj2lq8rm0000gn/T/pip-install-874ij9kc/mysqlclient_fc55de34f29b49d2b4257183fbda80c7/setup.py'"'"'; __file__='"'"'/private/var/folders/5t/6gk39nps1xv2cygwgj2lq8rm0000gn/T/pip-install-874ij9kc/mysqlclient_fc55de34f29b49d2b4257183fbda80c7/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/5t/6gk39nps1xv2cygwgj2lq8rm0000gn/T/pip-record-fqgxkw8g/install-record.txt --single-version-externally-managed --compile --install-headers /Users/jake_hong/miniconda3/envs/logitech/include/python3.8/mysqlclient
         cwd: /private/var/folders/5t/6gk39nps1xv2cygwgj2lq8rm0000gn/T/pip-install-874ij9kc/mysqlclient_fc55de34f29b49d2b4257183fbda80c7/
    Complete output (41 lines):
    mysql_config --version
    ['8.0.27']
    mysql_config --libs
    ['-L/usr/local/Cellar/mysql/8.0.27/lib', '-lmysqlclient', '-lz', '-lzstd', '-lssl', '-lcrypto', '-lresolv']
    mysql_config --cflags
    ['-I/usr/local/Cellar/mysql/8.0.27/include/mysql']
    ext_options:
      library_dirs: ['/usr/local/Cellar/mysql/8.0.27/lib']
      libraries: ['mysqlclient', 'resolv']
      extra_compile_args: ['-std=c99']
      extra_link_args: []
      include_dirs: ['/usr/local/Cellar/mysql/8.0.27/include/mysql']
      extra_objects: []
      define_macros: [('version_info', "(2,1,0,'final',0)"), ('__version__', '2.1.0')]
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.8
    creating build/lib.macosx-10.9-x86_64-3.8/MySQLdb
    copying MySQLdb/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
    copying MySQLdb/_exceptions.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
    copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
    copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
    copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
    copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
    copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
    creating build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
    copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
    copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
    copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
    copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
    copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
    copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
    running build_ext
    building 'MySQLdb._mysql' extension
    creating build/temp.macosx-10.9-x86_64-3.8
    creating build/temp.macosx-10.9-x86_64-3.8/MySQLdb
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/jake_hong/miniconda3/envs/logitech/include -arch x86_64 -I/Users/jake_hong/miniconda3/envs/logitech/include -arch x86_64 -Dversion_info=(2,1,0,'final',0) -D__version__=2.1.0 -I/usr/local/Cellar/mysql/8.0.27/include/mysql -I/Users/jake_hong/miniconda3/envs/logitech/include/python3.8 -c MySQLdb/_mysql.c -o build/temp.macosx-10.9-x86_64-3.8/MySQLdb/_mysql.o -std=c99
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/jake_hong/miniconda3/envs/logitech/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/5t/6gk39nps1xv2cygwgj2lq8rm0000gn/T/pip-install-874ij9kc/mysqlclient_fc55de34f29b49d2b4257183fbda80c7/setup.py'"'"'; __file__='"'"'/private/var/folders/5t/6gk39nps1xv2cygwgj2lq8rm0000gn/T/pip-install-874ij9kc/mysqlclient_fc55de34f29b49d2b4257183fbda80c7/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/5t/6gk39nps1xv2cygwgj2lq8rm0000gn/T/pip-record-fqgxkw8g/install-record.txt --single-version-externally-managed --compile --install-headers /Users/jake_hong/miniconda3/envs/logitech/include/python3.8/mysqlclient Check the logs for full command output.

mac os 업데이트를 한 후에는 xcode를 사용하지 않아도 xcode command line tools를 재설치 해주어야 xcrun 에러 없이 정상적으로 active developer path 가 작동된다.

xcode-select --install

os 업데이트 후 자주 발생하는 에러이며, git이 정상 작동하지 않는 경우도 있기때문에 기억해두자.

이미 설치가 되어있고 경로가 꼬여있을때는 아래 명령어를 입력하자.

xcode-select --reset

해당 에러가 해결 되고 난 후 gcc 에러는 자동적으로 해결 되었다.

~ pip install mysqlclient
Collecting mysqlclient
  Using cached mysqlclient-2.1.0.tar.gz (87 kB)
Building wheels for collected packages: mysqlclient
  Building wheel for mysqlclient (setup.py) ... done
  Created wheel for mysqlclient: filename=mysqlclient-2.1.0-cp38-cp38-macosx_10_10_x86_64.whl size=56167 sha256=620ac6ff82d62b55db5ac3a1b8fa2fdc32032aa68145203d0977a291e3153514
  Stored in directory: /Users/jake_hong/Library/Caches/pip/wheels/61/e7/42/9d56347e42d7ce19397c0ca050c6bef56640e18be7021ac189
Successfully built mysqlclient
Installing collected packages: mysqlclient
Successfully installed mysqlclient-2.1.0
profile
꾸준히!

0개의 댓글