MacOSX Catalina 에서 Cordova 로 하이브리드 아이폰앱 개발 시작하기

앱스토어를 통해 XCode 를 설치합니다.

Homebrew 설치

brew 를 통해 nodejs 를 설치합니다.

npm 으로 cordova 를 설치

Cordova 로 신규 앱 프로젝트를 생성합니다.

앱 프로젝트에 ios 플랫폼을 추가합니다.

ios 로 빌드하기 위해서는 일단 ios-deploy 를 설치해야 합니다.

% sudo npm install -g ios-deploy
Password: (현재맥북로그인계정 비밀번호를 입력합니다)

> ios-deploy@1.10.0 preinstall /usr/local/lib/node_modules/ios-deploy
> ./src/scripts/check_reqs.js && xcodebuild

stderr: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ios-deploy@1.10.0 preinstall: `./src/scripts/check_reqs.js && xcodebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ios-deploy@1.10.0 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/doogle/.npm/_logs/2020-02-13T06_28_07_938Z-debug.log

하지만 위와 같이 설치 도중 오류가 발생하는데요.

아래를 실행해 주면 해결됩니다. 경로 문제인듯 하네요.

% sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

이제 다시 ios-deploy 설치해보면 또 에러를 뿜어내는데요. 출력 내용을 잘 살펴보면 아래와 같은 내용을 찾을 수 있습니다.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!! WARNING: You are on OS X 10.11 El Capitan or greater, you may need to add the
!!!! WARNING:   `--unsafe-perm=true` flag when running `npm install`
!!!! WARNING:   or else it will fail.
!!!! WARNING: link:
!!!! WARNING:   https://github.com/ios-control/ios-deploy#os-x-1011-el-capitan-or-greater
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

OS X 10.11 El Caption 이나 혹은 그 이상의 버전에서는 –unsafe-perm=true 옵션을 추가해 보라고 되있네요.

% sudo npm install -g --unsafe-perm=true ios-deploy

이번엔 BUILD SUCCESS 라고 뜨면서 정상적으로 빌드가 되는 것을 확인 할 수 있습니다.