如何在macOS上安装Mono,以便Mono在终端上正常工作? [英] How to install Mono on macOS so mono works in terminal?

查看:2405
本文介绍了如何在macOS上安装Mono,以便Mono在终端上正常工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Mac(OS X 10.10.5版)上运行Mono安装,尽管安装说明已成功完成,但无法从终端调用Mono.

I'm trying to get a Mono install running on a mac (OS X version 10.10.5), and while the install states that it's completed successfully, I'm not able to call mono from the terminal.

要安装它,我以root用户身份运行uninstallMono.sh以确保没有剩余的碎片,然后运行MonoFramework-MDK-4.0.4.1.macos10.xamarin.x86.pkg.安装程序似乎已成功完成,但是尝试调用单声道返回

To install it, I ran uninstallMono.sh as root to ensure we didn't have any leftover cruft, then ran MonoFramework-MDK-4.0.4.1.macos10.xamarin.x86.pkg. The installer appeared to complete successfully, but an attempt to call mono returns

-bash:mono:找不到命令

-bash: mono: command not found

单声道框架确实已安装:

The mono framework does appear to be installed:

Lees-Mac-Pro:Downloads kevinmack$ cd /Volumes/Macintosh\ HD/Library/Frameworks/
Lees-Mac-Pro:Frameworks kevinmack$ ls -l
total 32
lrwxr-xr-x  1 root  wheel   71 Jan 20  2015 AEProfiling.framework -> ../../Applications/Motion.app/Contents/Frameworks/AEProfiling.framework
lrwxr-xr-x  1 root  wheel   74 Jan 20  2015 AERegistration.framework -> ../../Applications/Motion.app/Contents/Frameworks/AERegistration.framework
lrwxr-xr-x  1 root  wheel   74 Jan 20  2015 AudioMixEngine.framework -> ../../Applications/Motion.app/Contents/Frameworks/AudioMixEngine.framework
drwxr-xr-x  8 root  admin  272 Sep 12 11:24 Mono.framework
lrwxr-xr-x  1 root  wheel   60 Sep  9 22:16 NyxAudioAnalysis.framework -> /System/Library/PrivateFrameworks/NyxAudioAnalysis.framework
drwxr-xr-x  5 root  wheel  170 Jan 20  2015 PluginManager.framework
drwxr-xr-x  8 root  wheel  272 Sep  9 22:19 iTunesLibrary.framework

...但是它在/usr/bin中不存在,尝试使用which mono查找其可执行文件不会返回任何内容.

...but it isn't present in /usr/bin and attempting to find its executable using which mono returns nothing.

推荐答案

更新(因为两年后仍在获得观看次数):

最新版本的Mono(5.x)安装过程会在/etc/paths.d中创建一个文件(mono-commands),该文件包含以下路径:

Update (since this is still getting views two+ years later):

The latest versions of Mono (5.x) installation process creates a file (mono-commands) in /etc/paths.d that contains the path of:

/Library/Frameworks/Mono.framework/Versions/Current/Commands

所以/usr/local/bin不再使用...

较新版本的mono符合"El Capitan"的要求,即不要在/usr/bin 中安装任何内容,因此现在使用/usr/local/bin .我不确定从哪个版本开始的Mono 4.x版本.

Newer versions of mono comply to the "El Capitan" requirements of not installing anything into /usr/bin and thus now /usr/local/bin is used. I am not sure which mono 4.x release that started in...

但是我假设您的路径中没有/usr/local/bin(?),请尝试:

But I would assume that you do not have /usr/local/bin in your path(?), try:

export PATH=/usr/local/bin:${PATH}
which mono
which mcs

对于我来说,我已经安装了4.2.0:

In my case, I have 4.2.0 installed:

$ which mono
/usr/local/bin/mono
$ which mcs
/usr/local/bin/mcs
$ mono --version
Mono JIT compiler version 4.2.0 (explicit/2701b19 Mon Aug 31 09:57:28 EDT 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
$ cat `which mcs`
#!/bin/sh
export PATH=$PATH:/Library/Frameworks/Mono.framework/Versions/4.2.0/bin
export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/External/pkgconfig:/Library/Frameworks/Mono.framework/Versions/4.2.0/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/4.2.0/share/pkgconfig:$PKG_CONFIG_PATH
exec /Library/Frameworks/Mono.framework/Versions/4.2.0/bin/mono $MONO_OPTIONS /Library/Frameworks/Mono.framework/Versions/4.2.0/lib/mono/4.5/mcs.exe "$@"

这篇关于如何在macOS上安装Mono,以便Mono在终端上正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆