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!
Asked
Active
Viewed 2.9k times
11
-
Where did you get the binary from? I can't find one on their site. – Rafe Kettler Mar 07 '11 at 01:50
5 Answers
18
Try using Homebrew (Packet manager for Mac) and use the following command :-
brew install flex

Pawandeep Singh
- 830
- 1
- 13
- 25
4
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:
./configure
make
make install
make clean
Assuming you have make and a C compiler on your Mac, which I believe all Macs have.

rici
- 234,347
- 28
- 237
- 341

Rafe Kettler
- 75,757
- 21
- 156
- 151
-
Hey, i just did that there was bunch of text in terminal and i didn't see any errors. After that, I typed flex and path to the .lex file and nothing happened. Can you please tell me how I can use it? I searched on google and did exactly what i found. Thanks – user635064 Mar 07 '11 at 04:44
-
@RafeKettler I've been trying to do exactly the same steps, but the `make` command keep erring out saying `Undefined symbols for architecture x86_64: "_yylex"`. Any idea what to try to fix this? – Vladimir Mar 31 '15 at 21:56
-
@Wongzigii I fixed that somehow. I'll try to remember how today, but no promises. I think, if I recall correctly I either didn't have one of my files `#include`'d correctly, or I was using an `extern` without defining it in the right place. But I get back to you if I remember the exact fix. – Vladimir May 29 '15 at 14:04
3
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).

Jonathan Leffler
- 730,956
- 141
- 904
- 1,278

Juan Antonio Orozco
- 700
- 9
- 33
0
This info can help to somebody to save time:
Just today I have try to install FLEX 2.5.39 from sources. Make - fails.
After some thoughts I have decide to try older archives. 2.5.38 - fail 2.5.37 - OK
It seems on now() = 2015-03-15, macport also uses 2.5.37 build.

Ruslan Zasukhin
- 379
- 2
- 12