In order to develop a system for quality and safety evaluation of non-homogenised raw milk using near infrared (NIR) spectroscopy, two stages of research have been conducted. The first stage was the development of a compact NIR system for measuring the major constituents such as fat and protein in an aseptic environment. The second stage was the measurement of the total aerobic bacteria count (TBC). In the first stage, two compact sample holders for commercially-available capped test tube were designed. One system was equipped with an NIRSystem6500 research-type NIR spectrophotometer, hereafter referred to as MilkSpec-2. The other was equipped with a hand-held NIR spectrophotometer, the FT20, hereafter referred to as MilkSpec-3. For MilkSpec-2, the highly satisfactory results were obtained with the multiple determination coefficients of determination (R-2) = 0.99 and 0.96, and standard errors of prediction (SEP) = 0.03% and 0.07% for fat and protein, respectively. The results for MilkSpec-3 were also satisfactory but inferior compared with MilkSpec-2; the results were R-2 = 0.99 and 0.91 and SEP = 0.06% and 0.08% for fat and protein, respectively. In the following stage, MilkSpec-2 was used for the measurement of TBC in terms of Log colony forming units (CFU) mL(-1). In the case of TBC measurements, where the concentration of bacteria itself or its by-products were very low, three kinds of commercial test tube made of the same kind of glass but differing in diameter were used to identify the appropriate physical pathlength. It was found that the medium sized test tube with an external diameter of 20 mm provided the best calibration results with R-2 = 0.83, SEP = 0.55 log (CFU) mL(-1) and that the information related to absorptions by bacteria metabolites such as lactic acid, urea and those of the carbon sources such as lactose and protein in milk might play substantial roles in the NIR-TBC determination.