macos 在 Mac 上安装 flex(词法分析器)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5214978/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Installing flex (lexical analyzer) on Mac
提问by user635064
Can someone tell me how I can install flex (lexical analyzer) on my Mac? I searched everywhere on google and I can't find it. I have the universal binary and I extracted it to my desktop but I have no idea where to go from here. Any help would be greatly appreciated!
有人能告诉我如何在 Mac 上安装 flex(词法分析器)吗?我在谷歌上到处搜索,但找不到。我有通用二进制文件并将其解压缩到我的桌面,但我不知道从哪里开始。任何帮助将不胜感激!
回答by Pawandeep Singh
Try using Homebrew (Packet manager for Mac) and use the following command :-
尝试使用 Homebrew(Mac 的数据包管理器)并使用以下命令:-
brew install flex
回答by Rafe Kettler
You can always install from source. Download the tarball from the flex site, extract it, cd to the directory where you extracted it, and run the following:
您始终可以从源代码安装。从flex 站点下载 tarball ,解压,cd 到解压目录,然后运行以下命令:
./configure
make
make install
make clean
Assuming you have make and a C compiler on your Mac, which I believe all Macs have.
假设你的 Mac 上有 make 和 C 编译器,我相信所有的 Mac 都有。
回答by Juan Antonio Orozco
Flex is shipped with the xCode Command line tools; you only got to install them via xcode > preferences > downloads > Command line tools. This also includes gcc (Clang).
Flex 随 xCode 命令行工具一起提供;您只需通过 xcode > 首选项 > 下载 > 命令行工具安装它们。这也包括 gcc (Clang)。
回答by Ruslan Zasukhin
This info can help to somebody to save time:
此信息可以帮助某人节省时间:
Just today I have try to install FLEX 2.5.39 from sources. Make - fails.
就在今天,我尝试从源代码安装 FLEX 2.5.39。制作 - 失败。
After some thoughts I have decide to try older archives. 2.5.38 - fail 2.5.37 - OK
经过一番思考,我决定尝试使用较旧的档案。2.5.38 - 失败 2.5.37 - 正常
It seems on now() = 2015-03-15, macport also uses 2.5.37 build.
似乎在 now() = 2015-03-15,macport 也使用 2.5.37 版本。