Jekyll serve error: address already in use - bind(2) for 127.0.0.1:4000
Problem
After unexpectedly reload vscode for updating vscode,
as I served jekyll from local host by bundle exec jekyll serve,
jekyll 3.9.1 | Error:  Address already in use - bind(2) for 127.0.0.1:4000 pops up.
jekyll 3.9.1 | Error:  Address already in use - bind(2) for 127.0.0.1:4000:
the port 4000 is already in use meaning that the process is not killed yet by closing the vscode terminal.
Solution
- kill the process by finding process id (PID)
    - find pid using port 4000 (lsof: list open files)
        $ lsof -wni tcp:4000
- kill it
        kill -9 your_PID
 
- find pid using port 4000 (lsof: list open files)
        
- Set another port as jekyll serve --port 4001.
Unix, Linux μμ kill λͺ λ Ήμ΄λ‘ μμ νκ² νλ‘μΈμ€ μ’ λ£ μν€λ λ°©λ²
https://www.lesstif.com/system-admin/unix-linux-kill-12943674.html
kill -9 λ‘ signal μ 보λ΄λ©΄ κ°λ°μκ° κ΅¬νν μ’
λ£ ν¨μκ° νΈμΆλμ§ μκ³  μ¦μ νλ‘μΈμ€κ° μ’
λ£λμ΄ λ²λ¦¬λ―λ‘ λ°μ΄νκ° μ μ€λκ±°λ 리μμ€κ° μ λλ‘ μ λ«νλ ν° λ¬Έμ κ° λ°μν  μ μμ΅λλ€.
κ°μΈμ μΌλ‘ μΆμ²νλ λ°©λ²μ λ¨Όμ  kill -TERM PID λ kill -INT PID κ°μ΄ μ’
λ£λ₯Ό μλ―Ένλ signal μ μ¬λ¬ λ² μ μ‘ν΄ μ£Όλ κ²μ΄λ©° μ λλ‘ λ νλ‘κ·Έλ¨μ λ³΄ν΅ cleanup μ½λλ₯Ό μννκ³  μ’
λ£νκ² λ©λλ€.
 
      
    
Leave a comment