Skip to content

How to install Readline

Miguel Guardia edited this page Apr 5, 2024 · 1 revision

On 42 Madrid MACs

  1. Install homebrew by copying this command on a terminal and follow the steps.
rm -rf $HOME/.brew && git clone --depth=1 https://github.com/Homebrew/brew $HOME/.brew && echo 'export PATH=$HOME/.brew/bin:$PATH' >> $HOME/.zshrc && source $HOME/.zshrc && brew update
  1. Install readline and follow the steps.
brew install readline
  1. Make sure you have the correct lines uncommented on the minishell Makefile:
# MAC 42
CPPFLAGS	=	-I$(HOME)/.brew/opt/readline/include
LDFLAGS		=	-L$(HOME)/.brew/opt/readline/lib

# PERSONAL MAC
# CPPFLAGS	=	-I/usr/local/Cellar/readline/8.2.10/include
# LDFLAGS       =	-L/usr/local/Cellar/readline/8.2.10/lib

MacOS Sonoma

  1. Install homebrew.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install readline and follow the steps.
brew install readline
  1. Make sure you have the correct lines uncommented on the minishell Makefile:
# MAC 42
# CPPFLAGS	=	-I$(HOME)/.brew/opt/readline/include
# LDFLAGS	=	-L$(HOME)/.brew/opt/readline/lib

# PERSONAL MAC
CPPFLAGS	=	-I/usr/local/Cellar/readline/8.2.10/include
LDFLAGS         =	-L/usr/local/Cellar/readline/8.2.10/lib

This is working for me, make sure the path exits on your computer and your readline version is 8.2.10.

Linux

  1. Install readline and follow the steps.
sudo apt-get install libreadline-dev
  1. Compile only with -lreadline (already include, just comment CPPFLAGS and LDLFLAGS).
Clone this wiki locally