-
Notifications
You must be signed in to change notification settings - Fork 4
/
macsetup.js
38 lines (35 loc) · 1.46 KB
/
macsetup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright IBM Corp. 2015. All Rights Reserved.
// Node module: loopback-sdk-xm
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
var sys = require('sys');
var exec = require('child_process').exec;
outF = function (error, stdout, stderr) {
if(stdout) {
sys.print(stdout);
}
if (error !== null) {
console.log(error.toString());
}
};
if(process.platform !== 'win32') {
console.log('> Installing MacOS dependencies');
console.log('> Authorizing access to /usr/local and /Library (Needed for Homebrew and Mono64 installation)');
exec("sudo chown -R $USER /usr/local /Library", function(error, stdout, stderr) {
console.log('> Installing MacOS dependencies 1/3: Homebrew');
exec("ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\"", function(error, stdout, stderr) {
outF(error, stdout, stderr);
console.log('> Installing MacOS dependencies 2/3: Mono64. This might take a while.');
exec("brew install https://raw.githubusercontent.com/tjanczuk/edge/master/tools/mono64.rb", function(error, stdout, stderr) {
outF(error, stdout, stderr);
console.log('> Installing MacOS dependencies 3/3: pkg-config');
exec("brew install pkg-config", function(error, stdout, stderr) {
outF(error, stdout, stderr);
console.log('> Done installing MacOS dependencies.');
});
});
});
});
} else {
console.log('> On windows, not running MacSetup.');
}