Developing with my first Mac and I noticed that my Rspec output isn't colorized in my terminal even though I'm using the '-c' flag in the command: bundle exec rspec -c -fd. Any ideas?  
            Asked
            
        
        
            Active
            
        
            Viewed 7,847 times
        
    29
            
            
         
    
    
        steve_gallagher
        
- 3,778
- 8
- 33
- 51
- 
                    dup? http://stackoverflow.com/q/1819614/119790 – Ian Vaughan May 21 '13 at 10:33
3 Answers
57
            Add the following contents to a .rspec file to your project dir root.
--color
 
    
    
        Jens Tinfors
        
- 880
- 7
- 6
- 
                    10Or, place the .rspec file in your home directory to apply the settings for all projects. – Jimothy Mar 07 '13 at 13:48
15
            
            
        If you're coming here from Google recently, you may notice that Allen Chun's answer gives a NoMethodError with .color_enabled when using RSpec 3.0 or higher. .color_enabled was removed in 3.0: https://github.com/rspec/rspec-core/blob/master/Changelog.md#300rc1--2014-05-18
Just change .color_enabled to .color in spec_helper.rb:
RSpec.configure do |config|
  # Use color in STDOUT
  config.color = true
  # other config options here...    
end
This worked for me with Ruby 2.1.2p95 on OS X Mavericks 10.9.4.
 
    
    
        flanger001
        
- 757
- 6
- 16
7
            
            
        You can also put the config on the spec_helper.rb if you don't want to attach --color every time you run rspec.
RSpec.configure do |config|
 # Use color in STDOUT
   config.color_enabled = true
 # Use color not only in STDOUT but also in pagers and files
   config.tty = true
 # Use the specified formatter
   config.formatter = :documentation # :progress, :html, :textmate
end
 
    
    
        AllenC
        
- 2,754
- 1
- 41
- 74
- 
                    `config.color_enabled = true` didn't work for me, but `config.color = true` did. – Matt Waldron Jul 14 '17 at 19:40