Skip to content

Commit edfc370

Browse files
KishanBagariabestander
authored andcommitted
Change global prefix directory to /usr/local on OS X (#3458)
1 parent e6d5d30 commit edfc370

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/cli/commands/global.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type {Reporter} from '../../reporters/index.js';
44
import type {Manifest} from '../../types.js';
55
import type Config from '../../config.js';
66
import {MessageError} from '../../errors.js';
7+
import {OSX_GLOBAL_PREFIX_DIRECTORY} from '../../constants.js';
78
import {registries} from '../../registries/index.js';
89
import NoopReporter from '../../reporters/base-reporter.js';
910
import buildSubCommands from './_build-sub-commands.js';
@@ -76,6 +77,8 @@ function getGlobalPrefix(config: Config, flags: Object): string {
7677
return String(config.getOption('prefix'));
7778
} else if (process.env.PREFIX) {
7879
return process.env.PREFIX;
80+
} else if (process.platform === 'darwin') {
81+
return OSX_GLOBAL_PREFIX_DIRECTORY;
7982
} else if (process.platform === 'win32') {
8083
if (process.env.LOCALAPPDATA) {
8184
return path.join(process.env.LOCALAPPDATA, 'Yarn', 'bin');

src/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export const MODULE_CACHE_DIRECTORY = getCacheDirectory();
5858
export const CONFIG_DIRECTORY = getDirectory('config');
5959
export const LINK_REGISTRY_DIRECTORY = path.join(CONFIG_DIRECTORY, 'link');
6060
export const GLOBAL_MODULE_DIRECTORY = path.join(CONFIG_DIRECTORY, 'global');
61+
export const OSX_GLOBAL_PREFIX_DIRECTORY = '/usr/local';
6162

6263
export const META_FOLDER = '.yarn-meta';
6364
export const INTEGRITY_FILENAME = '.yarn-integrity';

0 commit comments

Comments
 (0)